Common Flows
This page shows the most common integration flows.
Initialize the SDK
// After your consent UI (UMP / ATT / etc.) returns a result:
CiaoConsent consent = new CiaoConsent(
gdprConsent: umpAccepted,
ccpaDoNotSell: false,
isChildDirected: false,
isUnderAgeOfConsent: false,
attGranted: attGranted);
// Subscribe to events here (Anti-Cheat, Ads, etc.) BEFORE Initialize.
CiaoSDKAntiCheat.OnSuspiciousActivityDetected += args =>
CiaoSDK.SendCheaterDetected(args);
// Initialize in your bootstrap (first) scene.
CiaoSDK.Initialize(consent);Show Ads
Banner
CiaoSDKAds.LoadBanner();
CiaoSDKAds.ShowBanner();
// ... later
CiaoSDKAds.HideBanner();Rewarded
if (CiaoSDKAds.IsRewardedReady)
{
CiaoSDKAds.ShowRewarded("doubleCoins", success => {
if (success) GrantDoubleCoins();
});
}Report an IAP
Call after successful IAP server-to-server (S2S) validation.
CiaoSDK.SendIAPPurchased(new IAPArgs(orderOrProduct));flowchart TB
UserIAP[User makes IAP purchase]
IAPSuccess[IAP transaction successful]
S2SVal[ S2S receipt validation]
NotValid[ CiaoSDK.SendCheaterDetected]
Valid[ CiaoSDK.SendIAPPurchased]
UserIAP --> IAPSuccess
IAPSuccess --> S2SVal
S2SVal -->|Not Valid| NotValid
S2SVal --> |Valid| Valid
Report Ad Revenue
Ad revenue is auto-reported to MMP and Analytics. No action is required.
Report an Ad Impression to Analytics
CiaoSDKAnalytics.SendAdImpression(new AdImpressionArgs(
adType: AdType.Interstitial,
adCount: 5,
levelId: currentLevel,
placement: "levelComplete"));Report Level Completed
var args = new LevelCompletedArgs(
level: 5,
ltv: _ltv,
interstitialViews: 3,
rewardedViews: 2,
time: 300,
session: 10,
playerLevel: 10,
currencyName: "Coins",
currencyBalance: 100);
CiaoSDK.SendLevelCompleted(args);LTV Reporting
To track lifetime value from ad revenue:
- Subscribe to
CiaoSDKAds.OnImpressionDataReady. - Accumulate the impression revenue in a persistent variable (local storage, server, or your preferred persistence method).
- When the user completes a level, pass the accumulated value as
ltvtoCiaoSDK.SendLevelCompleted.
LTV is cumulative from install. Do not reset it per level.
Updated about 6 hours ago
Did this page help you?
