Links

Transmit the user consent to other SDKs

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.

Transmit the IAB string

The consent signal is stored in a specific UserDefaults and 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 method to obtain and pass the IAB string:
Swift
Objective-C
OguryChoiceManager.shared().tcfV2.getIABConsentString()
[[[OguryChoiceManager sharedManager] tcfV2] getIABConsentString];
We recommend to use this method only in the completion block of the ask andedit methods 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:
Swift
Objective-C
OguryChoiceManager.shared().tcfV2.isAccepted(vendorId)
[[[OguryChoiceManager sharedManager] tcfV2] isAccepted:vendorId];
The isAccepted method takes the following parameter:
  • a vendorId Int, 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 method only in the completion block of the ask and edit methods to get the updated value.
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 by calling the following method:
Swift
Objective-C
OguryChoiceManager.shared().tcfV2.isPurposeAccepted(purpose)
[[[OguryChoiceManager sharedManager] tcfV2] isPurposeAccepted: purpose];
The isPurposeAccepted method takes the following parameter:
  • a OguryChoiceManagerPurpose representing a purpose. It can take one of the following values:
Purpose values
IAB purpose names
OguryChoiceManagerPurposeStoreInformation
Information storage and access
OguryChoiceManagerPurposeSelectBasicAds
Select basic ads
OguryChoiceManagerPurposeCreatePersonalisedAds
Create personalised ads
OguryChoiceManagerPurposeSelectPersonalisedAds
Select personalised ads
OguryChoiceManagerPurposeCreatePersonalisedContent
Create personalised content
OguryChoiceManagerPurposeSelectPersonalisedContent
Select personalised content
OguryChoiceManagerPurposeMeasureAdPerformance
Measure ad performance
OguryChoiceManagerPurposeMeasureContentPerformance
Measure content performance
OguryChoiceManagerPurposeMarketResearch
Market research
OguryChoiceManagerPurposeDevelopAndImproveProducts
Develop and improve products
We recommend to use this method only in the completion block of the ask and edit methods to get the updated value.
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 purpose 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.
Swift
Objective-C
OguryChoiceManager.tcfV2.isVendorAndItsPurposesAccepted(vendorId);
[[[OguryChoiceManager sharedManager] tcfV2] isVendorAndItsPurposesAccepted: vendorId];
The isVendorAndItsPurposesAccepted method takes the following parameter:
  • a vendorId Int, 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 vendorId 0 in the isVendorAndItsPurposesAccepted method.
We recommend to use this method only in the completion block of the ask and edit methods to get the updated value.
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.

Integration example

Find below an example of user consent handling for several vendors.
Swift
Objective-C
import UIKit
import OguryChoiceManager
import OguryAds
import GoogleMobileAds
class ViewController: UIViewController {
var interstitial: DFPInterstitial!
override func viewDidLoad() {
super.viewDidLoad()
// you can initialize SDK here or in AppDelegate
let config = OguryChoiceManagerConfig.default()
OguryChoiceManager.shared().setup(withAssetKey: "ASSET_KEY", andConfig: config)
// get user consent
OguryChoiceManager.shared().ask(with: self) { (error, response) in
// pass user consent to vendors' SDKs
passConsentToOtherSdks()
// start SDKs
startSdks()
// load ad formats
loadInterstitialAd();
}
private func passConsentToOtherSdks() {
// pass consent through IAB string
let iabString = OguryChoiceManager.shared().getIABConsentString()
vendorSdk.setConsentFromIABString(iabString)
// check if a vendor is accepted
let vendorAccepted = OguryChoiceManager.shared().tcfV2.isAccepted(vendorIdInt)
anotherVendorSdk.setConsent(vendorAccepted)
// check consent for yourself and for your analytics solution
let meAccepted = OguryChoiceManager.shared().tcfV2.isAccepted(0)
let analyticsVendorAccepted = OguryChoiceManager.shared().tcfV2.isAccepted(analyticsVendorSlugId)
// for analytics we check the MEASUREMENT purpose
let measurementPurposeAccepted = OguryChoiceManager.shared().tcfV2.isPurposeAccepted(.measurement)
analyticsSdk.setConsent(meAccepted && analyticsVendorAccepted && measurementPurposeAccepted)
}
private func startSdks() {
// [optional] start the Ogury SDK
OguryAds.shared().setup(withAssetKey: "ASSET_KEY")
// start vendors' SDK
vendorSdk.start()
anotherVendorSdk.start()
analyticsSdk.start()
}
private func loadInterstitialAd() {
// pass consent to the GAM SDK
let googleAccepted = OguryChoiceManager.shared().tcfV2.isAccepted(459)
let extras = GADExtras()
extras.additionalParameters = ["npa": googleAccepted ? "0" : "1"]
let request = DFPRequest()
request.register(extras)
interstitial = DFPInterstitial(adUnitID: "GAM_AD_UNIT_ID")
interstitial.load(request)
}
}
#import <UIKit/UIKit.h>
#import <OguryAds/OguryAds.h>
#import <OguryChoiceManager/OguryChoiceManager.h>
#import <GoogleMobileAds/GoogleMobileAds.h>
@interface ViewController : UIViewController
@property (retain) DFPInterstitial* interstitial;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// you can initialize SDK here or in AppDelegate
OguryChoiceManagerConfig *config = [[OguryChoiceManagerConfig defaultConfig];
[[OguryChoiceManager sharedManager] setupWithAssetKey:@"ASSET_KEY" andConfig:config];
// get user consent
[[OguryChoiceManager sharedManager] askWithViewController:self andCompletionBlock:^(NSError *error, OguryChoiceManagerAnswer answer) {
// pass user consent to vendors' SDKs
[self passConsentToVendorSdks];
// initialize vendors' SDKs
[self startSdks];
// load ad formats...
[self loadInterstitialAd];
}];
}
- (void)passConsentToOtherSdks {
// pass consent through IAB string
NSString *iabString = [[[OguryChoiceManager sharedManager] tcfV2] getIABConsentString];
[vendorSdk setConsentFromIABString:iabString];
// check if a vendor is accepted
BOOL vendrAccepted = [[[OguryChoiceManager sharedManager] tcfV2] isAccepted:vendorId];
[anotherVendorSdk setConsent:vendrAccepted];
// check consent for yourself and for your analytics solution
BOOL meAccepted = [[[OguryChoiceManager sharedManager] tcfV2] isAccepted:yourVendorId];
BOOL analyticsVendorAccepted = [[[OguryChoiceManager sharedManager] tcfV2] isAccepted:analyticsVendorId];
// for analytics we check the MEASUREMENT purpose
BOOL mesurementPurposeAccepted = [[[OguryChoiceManager sharedManager] tcfV2] isPurposeAccepted:OguryChoiceManagerPurposeMeasureContentPerformance];
[analyticsSdk setConsent:meAccepted && analyticsVendorAccepted && mesurementPurposeAccepted];
}
- (void)startSdks {
// start the Ogury SDK
[[OguryAds shared] setupWithAssetKey:@"ASSET_KEY"];
// start vendors' SDKs
[vendorSdk start];
[anotherVendorSdk start];
[analyticsSdk start];
}
- (void)loadInterstitialAd {
// pass consent to AdMob SDK
BOOL googleAccepted = [[[OguryChoiceManager sharedManager] tcfV2] isAccepted:459];
NSMutableDictionary *additionalParameters = [NSMutableDictionary dictionary];
if (!googleAccepted) {
additionalParameters[@"npa"] = @"1";
}
GADExtras* extras = [GADExtras new];
[extras setAdditionalParameters:additionalParameters];
DFPRequest* request = [DFPRequest request];
[request registerAdNetworkExtras:extras];
self.interstitial = [[DFPInterstitial alloc] initWithAdUnitID:@"GAM_AD_UNIT_ID"];
[self.interstitial loadRequest:request];
}
@end