API usages

As of November 13, 2023, Ogury Choice Manager is deprecated, meaning it will no longer be supported or updated.

Consequently, no new consent notices will be delivered through Ogury Choice Manager's APIs. Therefore, it is strongly advised against using Ogury Choice Manager in new versions of applications. In case you have migrated to a new Consent Management Platform (CMP), ensure that Ogury and its partners are included as vendors.

For earlier versions of applications still using Ogury Choice Manager, the API will maintain its functionality, continuing to return consent for users who have previously responded to a consent notice. This will remain in effect until their consent expires.

There are several options to access and pass the consent signal to your partners: You can get and transmit the USP string if your vendor's SDK is able to handle it, as the USP string contains the complete consent signal. Alternatively, you can check if user opted out from sale of their personal data, if notice has been shown to the user, or check the Limited Service Provider Agreement (LSPA) configuration used to generate the US privacy string.

Check if the CCPA applies

To check if the CCPA applies in the region of the user, you can call the following method:

OguryChoiceManager.CcpaApplies;

We recommend to use this property only in the OnAskComplete/OnEditComplete event callbacks to get the updated value of the consent signal.

Transmit the USP string

The consent signal is stored in:

  • a specific SharedPreferences on Android;

  • a specific UserDefaults on iOS.

It is automatically passed to the vendors supporting the USPrivacy string (CCPA).

While being registered to the IAB CCPA, some vendors need to explicitly receive the USP string. Check with your vendors to ensure that they process the consent signal by themselves. Otherwise, you can use the following method to obtain and pass the USP string:

OguryChoiceManager.CcpafV1.UspString;

We recommend to use this property only in the OnAskComplete/OnEditComplete event callbacks to get the updated value of the consent signal.

If there is no consent signal for a given user, this method returns an empty string as default value. In this case, you should start the vendor's SDK as if the user had not provided their consent. The consent notice will be displayed at the next Ask call, and the consent status will then be updated.

Per CCPA regulation, just showing Consent notice to the user and explaining its rights constitutes the positive signal for publishers. In order for a user to preserve its personal data, they must choose an option to opt-out from selling its personal data. To check if Consent notice was served to the user and regulation was being followed, call:

OguryChoiceManager.CcpafV1.HasSeenNotice;

We recommend to use this property only in the OnAskComplete/OnEditComplete event callbacks to get the updated value of the consent signal.

Check opt-out status

Per CCPA regulation, a user can choose to opt-out from selling of their personal data. To check the status of user choice call:

OguryChoiceManager.CcpafV1.IsOptOutSale;

We recommend to use this property only in the OnAskComplete/OnEditComplete event callbacks to get the updated value of the consent signal.

Check LSPA status

To check if a signatory to the IAB Limited Service Provider Agreement(LSPA) is done and that the transaction is covered as a “Covered Opt Out Transaction” or a “Non Opt Out Transaction” as those terms are defined in the Agreement, call:

OguryChoiceManager.CcpafV1.IsLspa;

We recommend to use this property only in the OnAskComplete/OnEditComplete event callbacks to get the updated value of the consent signal.

Integration example

Find below an example of user consent handling.

using OgurySdk;

public class MyScene : MonoBehaviour {

    void Start() {
        Ogury.Start("ANDROID_ASSET_KEY", "IOS_ASSET_KEY");
        
        // implement choice manager events
        OguryChoiceManager.OnAskComplete += OnCMComplete;
        OguryChoiceManager.OnAskError += OnCMError;
        
        // get user consent
        OguryChoiceManager.Ask();
    }
    
    private void OnDestroy() {
        OguryChoiceManager.OnAskComplete -= OnCMComplete;
        OguryChoiceManager.OnAskError -= OnCMError;
    }
    
    private void OnCMComplete(OguryChoiceManager.Answer answer) {
        // pass user consent to vendors' SDKs
        PassConsentToOtherSdks();
        // initialize vendors' SDKs
        StartSdk();
        // load ad formats
        LoadAdFormats();
    }

    private void OnCMError(OguryError error) {
        // pass user consent to vendors' SDKs
        PassConsentToOtherSdks();
        // initialize vendors' SDKs
        StartSdk();
        // load ad formats
        LoadAdFormats();
    }
    
    private void PassConsentToOtherSdks() {
        if (OguryChoiceManager.CcpaApplies) {
            // pass consent through USP string
            var uspString = OguryChoiceManager.CcpafV1.UspString;
            _vendorSdk.setConsentFromUSPString(uspString);
            
            // or pass consent through booleans
            boolean hasSeenNotice = OguryChoiceManager.CcpafV1.HasSeenNotice;
            _anotherVendorSdk.setHasSeenNotice(hasSeenNotice);
            
            boolean isOptOutSale = OguryChoiceManager.CcpafV1.IsOptOutSale;
            _anotherVendorSdk.setIsOptOutSale(isOptOutSale); 
            
            boolean isLspa = OguryChoiceManager.CcpafV1.IsLspa;
            _anotherVendorSdk.setIsLspa(isLspa);
        } else if (OguryChoiceManager.GdprApplies) {
            // pass consent through IAB string
            var iabString = OguryChoiceManager.TcfV2.IabString;
            _vendorSdk.SetConsentFromIABString(iabString);
            
            // check if a vendor is accepted
            var vendorAccepted = OguryChoiceManager.TcfV2.IsAccepted(AnotherVendorId);
            _anotherVendorSdk.SetConsent(vendorAccepted);
            
            // check consent for yourself
            var meAccepted = OguryChoiceManager.TcfV2.IsAccepted(0);
            // check consent your analytics solution and its purposes
            boolean isAnalyticsVendorAndItsPurposesAccepted = OguryChoiceManager.TcfV2.isVendorAndItsPurposesAccepted(analyticsVendorId);
            _analyticsSdk.SetConsent(meAccepted && analyticsVendorAccepted);
        }
    }

    private void StartSdk() {
        // initialize Ogury Ads
        Ogury.StartAds();
        // start vendors' SDKs
        _vendorSdk.Start();
        _anotherVendorSdk.Start();
        _analyticsSdk.Start();
    }
    
    private void LoadAdFormats() {
        // load ad formats
        _yourAdFormat.load();
    }
}

Last updated