Transmit the user consent

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, with a precise status on each vendor and purpose. You can get and transmit the IAB string if your vendor's SDK is able to handle it, as the IAB string contains the complete consent signal. Alternatively, you can check the list of vendors and/or purposes that were accepted by the user and transmit that specific information.‌

Check if the GDPR applies

To check if the GDPR applies in the region of the user, you can call the following property:

OguryChoiceManager.GdprApplies;

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

Transmit the IAB 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 IAB Transparency and Consent Framework (TCF).‌

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

OguryChoiceManager.TcfV2.IabString;

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.‌

Depending on the user consent choices, you may need to enable/disable some functionalities or vendor's SDK. You can check whether the user has accepted the usage of personal data for a particular vendor by calling the following method:

OguryChoiceManager.TcfV2.IsAccepted(vendorId);

The IsAccepted method takes the following parameter:‌

  • a vendorId integer, uniquely identifying each vendor. As an example, the vendor id is 277 for Ogury. You can find the list of all vendor ids in the Ogury Choice Manager vendor list.

Note that you can identify yourself as a vendor if you need specific consent for some use cases involving personal data. In this case, you first need to add yourself as a vendor in the consent notice, and then use the vendor id 0 in the IsAccepted method.

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 falseas default value. In this case, you can 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.‌

Similarly to vendors, you can access consent status for each IAB purposes, and pass this signal to your vendors and your own processes accordingly. Users can consent to all purposes at once or opt-in to only a few of them.‌

You can check whether the user has accepted to share their data for a given purpose or more than one purpose by calling the method IsPurposeAccepted.‌

Check for a single purpose

OguryChoiceManager.TcfV2.IsPurposeAccepted(purposeId);

The IsPurposeAccepted method takes the following parameter:‌

  • a purposeId integer, uniquely identifying each purpose. Purpose ids are enumerated in OguryChoiceManager.TcfV2.Purpose:

Purpose values

IAB purpose names

StoreInformation

Information storage and access

SelectBasicAds

Select basic ads

CreatePersonalisedAds

Create personalized ads

SelectPersonalisedAds

Select personalized ads

CreatePersonalisedContent

Create personalized content

SelectPersonalisedConten

Select personalized content

MeasureAdPerformance

Measure ad performance

MeasureContentPerformance

Measure content performance

MarketResearch

Market research

DevelopAndImproveProducts

Develop and improve products

Check for multiple purposes

The IsPurposeAccepted method can also check if all purposes within a list are accepted:

OguryChoiceManager.TcfV2.isPurposeAccepted(purposesId0 | purposeId1);

Apply the OR operator(|) between each purpose you want to check. The following example check for both the SelectBasicAds and the MarketResearch purposes:

OguryChoiceManager.TcfV2.IsPurposeAccepted(
    OguryChoiceManager.TcfV2.Purpose.SelectBasicAds | 
    OguryChoiceManager.TcfV2.Purpose.MarketResearch);

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 falseas default value. In this case, you can 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.‌

Transmit purposes and vendor specific status for a particular vendor

Depending on users consent choices you can check status for a particular vendor and all IAB purposes declared under Consent by that vendor to, for example enable/disable that vendor’s SDK.‌

You can check whether all consent based purposes declared by this vendor are accepted by the user along with the vendor itself.

OguryChoiceManager.TcfV2.IsVendorAndItsPurposesAccepted(vendorId);‌

The IsVendorAndItsPurposesAccepted method takes following parameter:‌

  • a vendorId integer, uniquely identifying each vendor. As an example, the vendor id is 277 for Ogury. You can find the list of all vendor identifiers in the Ogury Choice Manager vendor list.

Note that you can identify yourself as a vendor if you need specific consent for some use cases involving personal data. In this case, you first need to add yourself as a vendor in the consent notice, and then use the vendorId 0 in the IsVendorAndItsPurposesAccepted method.‌

Integration example

Find below an example of user consent handling for several vendors.

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() {
        // 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() {
        // call the start methods of vendors' SDKs
        _vendorSdk.Start();
        _anotherVendorSdk.Start();
        _analyticsSdk.Start();
    }
    
    private void LoadAdFormats() {
        // load ad formats
        _yourAdFormat.load();
    }
}

Last updated