Integrating in your code


1. Consent

CiaoSDK needs a consent object to be initialized, thus it must be initialized after your consent logic.
When done, create and set a CiaoConsent: CiaoConsent

// Build consent from your consent UI (UMP / ATT / etc.).
CiaoConsent consent = new CiaoConsent(
    gdprConsent:          true,
    ccpaDoNotSell:        false,
    isChildDirected:      false,
    isUnderAgeOfConsent:  false,
    attGranted:           true);

Per-module consent (optional)

If users can consent to analytics or attribution but decline personalized ads (or vice versa), you can override gdprConsent per module:

CiaoConsent consent = new CiaoConsent(
    gdprConsent:          true,
    adsConsent:           false,  // user declined personalized ads
    mmpConsent:           true,   // user accepted attribution
    analyticsConsent:     true,   // user accepted analytics
    ccpaDoNotSell:        false,
    isChildDirected:      false,
    isUnderAgeOfConsent:  false,
    attGranted:           true);

If adsConsent, mmpConsent, or analyticsConsent are not set, they inherit from gdprConsent.

2. Anti-Cheat

Subscribe to Anti-Cheat events BEFORE calling Initialise: CiaoSDKAntiCheat.OnSuspiciousActivityDetected

CiaoSDKAntiCheat.OnSuspiciousActivityDetected += args =>
    CiaoSDK.SendCheaterDetected(args);

3. Initialise CiaoSDK

Initialise CiaoSDK in your bootstrap (first) scene: CiaoSDK.Initialize

CiaoSDK.Initialize(consent);

Deferred ads initialization (optional)

If you want to defer LevelPlay (ads) initialization, for example to show a loading screen without triggering ad preloads, pass skipAdsInit: true. MMP and Analytics still initialize based on their consent flags.

CiaoSDK.Initialize(consent, skipAdsInit: true);

Later, call CiaoSDK.UpdateConsent with skipAdsInit: false to initialize LevelPlay:

CiaoSDK.UpdateConsent(consent, skipAdsInit: false);

4. Report Level Completed

When user completes a level, report it: CiaoSDK.SendLevelCompleted
Pay attention to ltv reporting

CiaoSDK.SendLevelCompleted(new LevelCompletedArgs {
    level   = 1,
    time    = 45,
    session = 1,
    ltv     = 0.0f
});

5. Report IAP Purchase

When user makes a successful and valid IAP, report it: CiaoSDK.SendIAPPurchased

// Report an IAP (Unity IAP v5).
CiaoSDK.SendIAPPurchased(new IAPArgs(order, false));
// Report an IAP (Unity IAP v4).
CiaoSDK.SendIAPPurchased(new IAPArgs(args.purchasedProduct, false));
// Report an IAP (Non-Unity)
var args = new RevenueArgs(
    currency:        "USD",
    amount:          9.99,
    productSKU:      "coin_pack_medium",
    transactionId:   orderId,
    source:          "your_payment_source",
    productName:     "Medium Coin Pack",
    productCategory: "Coins");

CiaoSDK.SendIAPPurchased(args);
⚠️

IAP Reporting

Minimum Singular Unity SDK version is 5.8.0 when using Unity IAP v5 on iOS.
Singular 5.7.0 and earlier do not support StoreKit 2 receipt validation, which Unity IAP v5 uses on iOS.
If you must use Singular 5.7.0 or earlier, stay on Unity IAP v4.

6. Report a cheater

If you get a signal from Anti-Cheat for suspicious behaviour and you evaluate as a cheat, report it: CiaoSDK.SendCheaterDetected

CiaoSDK.SendCheaterDetected(cheatArgs);

7. Show an Ad

Show Ads: CiaoSDKAds.ShowRewarded etc..

//    Interstitial and Rewarded ads are auto-loaded.
//    Ad Revenue is auto-reported — you do not need to report it manually.
CiaoSDKAds.ShowRewarded("reviveOnDeath", success => {
    if (success) GrantReward();
});

8. Ad Revenue

Ad Revenue: this is reported automatically by CiaoSDK

9. Custom Events

CiaoSDK supports custom events to both Singular and ByteBrew.

// Custom event with no parameters  (THIS IS NOT IAP REPORT REVENUE, you can send it as extra event to your IAP report)
CiaoSDK.SendEvent("iap_smallpack");

// With parameters (THIS IS NOT IAP REPORT REVENUE, you can send it as extra event to your IAP report):
CiaoSDK.SendEvent("iap_smallpack", new Dictionary<string, string>
{
    { "price",     "2.99" },
    { "currency",  "USD" },
    { "productId", "com.mystudio.mygame.smallpack" }
});

// Random step example:
CiaoSDK.SendEvent("step_completed", new Dictionary<string, string>
{
    { "step",   "5" },
    { "time",  "42" }
});

10. Custom Events (Module specific)

CiaoSDK supports custom events only for Singular or ByteBrew.

// custom event only to Singular
CiaoSDKMMP.SendEvent("iap_smallpack");

// custom event only to ByteBrew
CiaoSDKAnalytics.SendEvent("iap_smallpack");

Key Points

  • Call CiaoSDK.Initialize(consent) once in your bootstrap scene.
  • Subscribe to events (Anti-Cheat, Ads) before calling Initialize.
  • Ad Revenue is auto-reported to MMP and Analytics - you never need to send it manually.
  • Interstitial and Rewarded ads are auto-loaded - just check IsInterstitialReady / IsRewardedReady before showing.
  • If you pass skipAdsInit: true to Initialize, ads will not load until you call UpdateConsent with skipAdsInit: false.

Did this page help you?