Links

Collect the user consent

Ogury Choice Manager handles user consent collection and storage for all your vendors, with a simple integration, ensuring compliance with the GDPR regulation. Your users are shown a single consent notice giving them the choice of the data they want to share, if any.
As a solution approved by the IAB Transparency and Consent Framework (TCF), Ogury Choice Manager not only meets the letter of the law, but is also aligned with all relevant best practice standards.
But where other solutions draw the line here, Ogury Choice Manager goes one step further by incorporating vendors that fall outside of IAB jurisdiction, including Facebook and Google. The net result is a definitive, one-stop consent notice that covers most vendors available on the market today.
Alternatively, if you already have a consent manager you can transmit the consent through the third-party consent manager integration.

Requirements

You have a registered application on your Ogury Dashboard. If not, please refer to the getting started section before the next steps.

Step 1: Setup Ogury SDK

In order to use Ogury Choice Manager you have to setup the SDK first. This method must be called before any other Choice Manager method. We recommend to call setup in AppDelegate class, function didFinishLaunchingWithOptions before starting any UIViewController.
You can call the setup method as follows:
  • For version 2.0.0.1 and above :
Swift
Objective-C
let configuration = OguryConfigurationBuilder(assetKey: "OGY-XXXXXXXXXXXX").build()
Ogury.start(with: configuration)
OguryConfigurationBuilder *configurationBuilder = [[OguryConfigurationBuilder alloc] initWithAssetKey:@"OGY-XXXXXXXXXXXX"];
[Ogury startWithConfiguration:[configurationBuilder build]];
  • For version 1.5.2.0 :
Swift
Objective-C
OguryChoiceManager.shared().setup(withAssetKey: "asset_key");
[OguryChoiceManager.sharedManager setupWithAssetKey:@"asset_key"];
If you don't have the Asset Key of your application, please refer to the first step.
To collect the user consent for the all registered vendors, call the ask method in the viewDidLoad of your ViewController.
This method displays a consent notice allowing the user to choose with which vendors and purposes they agree to share data. This notice is only displayed when there is no existing consent status for this user. Otherwise the ask method synchronizes the consent signal and makes it available through the SDK methods.
You can call the ask method as follows:
Swift
Objective-C
OguryChoiceManager.shared().ask(with: viewController) { (error, response) in
}
[[OguryChoiceManager sharedManager] askWithViewController:viewController andCompletionBlock:^(NSError *error, OguryChoiceManagerAnswer answer) {
}];
The ask method takes the following parameters:
  • the current ViewController
  • a completionBlock to listen to changes of the consent signal. This completion block provides two parameters :
Parameters
Definition
response
A consent notice has been displayed to the user or the consent status has been synchronized. You can handle the status of the consent to use it with vendors' SDKs. Learn more about user consent handling.
error
An error occurred. In this case, nothing is displayed to the user and the consent status is not synchronized. Learn more about consent error handling.
Theask method must be called at each launch of your application to be sure to have an up-to-date consent status.

Integration example

You must initialize Ogury Ads in the completion block of the ask method to have the user consent for the first ad impression.
Note that the Ogury SDK will only serve non-personalized ads, lowering your expected revenue, if (i) you don't initialize the Ogury Ads in these completion block, or if (ii) an error occurs.
Once the Ogury Ads are correctly initialized, the user consent is automatically synchronized across all Ogury products.
Swift
Objective-C
import UIKit
import OgurySdk
import OguryAds
import OguryChoiceManager
import GoogleMobileAds
class ViewController: UIViewController {
var interstitial: DFPInterstitial!
override func viewDidLoad() {
super.viewDidLoad()
//Setup SDK
let configuration = OguryConfigurationBuilder(assetKey: "OGY-XXXXXXXXXXXX").build()
Ogury.start(with: configuration)
// get user consent
OguryChoiceManager.shared().ask(with: self) { (error, response) in
// start the Ogury SDK
self.loadInterstitialAd()
}
}
private func loadInterstitialAd() {
// pass consent to the GAM SDK
let googleAccepted = OguryChoiceManager.shared().tcfV2.isAccepted(3)
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];
// setup SDK
OguryConfigurationBuilder *configurationBuilder = [[OguryConfigurationBuilder alloc] initWithAssetKey:@"OGY-XXXXXXXXXXXX"];
[Ogury startWithConfiguration:[configurationBuilder build]];
// get user consent
[[OguryChoiceManager sharedManager] askWithViewController:self andCompletionBlock:^(NSError *error, OguryChoiceManagerAnswer answer) {
[self loadInterstitialAd];
}];
}
- (void)loadInterstitialAd {
// pass consent to GAM SDK
BOOL googleAccepted = [[[OguryChoiceManager sharedManager] tcfV2] isAccepted:3];
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
As per the GDPR regulation, publishers need to ensure the users can access and edit their consent choices through their application at any time.
The edit method forces the display of the consent notice and let users update their choices. If an error occurred, nothing is displayed to the user. In this case, you need to handle the error to inform the user.
Swift
Objective-C
OguryChoiceManager.shared().edit(with: viewController) { (error, response) in
}
[[OguryChoiceManager sharedManager] editWithViewController:viewController andCompletionBlock:^(NSError *error, OguryChoiceManagerAnswer answer) {
}];
The edit method takes the following parameters:
  • the current ViewController
  • a completionBlock to listen to changes of the consent signal. This completion block provides two parameters :
Parameters
Definition
response
A consent notice has been displayed to the user or the consent status has been synchronized. You can handle the status of the consent to use it with vendors' SDKs. Learn more about user consent handling.
error
An error occurred. In this case, nothing is displayed to the user and the consent status is not synchronized. Learn more about consent error handling.
We recommend to expose a button to edit the consent in the application settings.

Step 4: Finish your integration

Congratulations! Ogury Choice Manager is now implemented. You can now go back to the getting started section and finish your integration.
However, should you have other vendors' SDKs processing user data, you can learn how to transmit them the consent signal in the Transmit consent to other SDKs article.

Advanced Topics

Possible user answer‌

In the reponse parameter of completion block, you can get the answer of the user through an Answer object. The Answer has one of the following values:
Answer values
Definition
FULL_APPROVAL
The user has approved all vendors and all purposes displayed in the consent notice.
PARTIAL_APPROVAL
The user has approved some vendors and/or some purposes displayed in the consent notice.
REFUSAL
The user has refused all vendors and all purposes displayed in the consent notice.
NO_ANSWER
The user has not responded.

Error handling

If Ogury Choice Manager fails to get the consent signal for any reason during an ask or an edit, the completion block provides an error parameter. This parameter contains the cause of the failure.‌
To get this cause, you can call the following method:
error.code
The error can be one of the following:
Code
Value
Definition
OGYConsentErrorNoInternetConnection
0
The device has no internet connection. Try again when the device is connected to Internet.
OGYConsentErrorTypeNoSuchAssetKey
1
The Asset Key passed in the method is unknown. Make sure to copy the exact Asset Key from the Ogury Dashboard (see the getting started section for more information). It may also occur while new configurations are propagating immediately following the creation of the application.
OGYConsentErrorTypeBundleNotMatching
2
The bundle registered on the Ogury Dashboard does not match the iOS bundle of the running application. Check that you have copied the Asset Key corresponding to the current application from the Ogury Dashboard (see the getting started section for more information).
OGYConsentErrorTypeServerError
3
The server has failed to respond because of an internal error. Please try again.
OGYConsentErrorTypeInternalSDKError
4
An internal SDK error has occurred. Please try again.
OGYConsentErrorTypeRegionRestricted
1000
The device is in a region not allowed to show the consent.
OGYConsentErrorTypeSdkAskNotCalled
1001
The ask method has not been called.
OGYConsentErrorTypeSdkTimeOut
1002
The request has time out.
Please try again.
OGYConsentErrorTypeFormError
1003
Form side error has occurred. Please try again.
OGYConsentErrorTypeParsingError
1004
Data parsing error has occurred. Please try again.
OGYConsentErrorTypeEditDisabledUserHasPaid
1006
The edit option is disabled because the user has paid.
OGYConsentErrorTypeIOSUserRestricted
1007
iOS user restricted from consent
OGYConsentErrorTypeUserGeoRestricted
1008
The current user is geo-restricted from consent.
OGYConsentErrorTypeSetupNotCalled
1009
The setup method has not been called.