CMP Integration (GDPR)


This documentation is a guide for integrating the Smaato SDK in regards to the GDPR Consent Tool and the Consent Management Platform (CMP) for mobile apps. If you have any questions regarding the installation and integration process, please contact Smaato’s support team. Please keep in mind that this might only be necessary for those publishers who are based in the European Economic Area.


What do European based publishers need for integrating the GDPR version of the Smaato SDK?

CMP – Consent Management Platform, is a web-based tool tailored to ask an end user for the consent and list all available consent options. CMP is a platform and depending on the vendor it can provide options to change the dialog copy, list partners (vendors), consent purposes, and provide translations with multiple languages up to the point of changing UI of the consent tool.

For the purposes of this guide the default CMP, provided by Smaato (developed by AppNexus), will be used as a reference. Other CMPs that follow the IAB Europe specifications can also be used.

Wrapper – The wrapper is a mediation layer between the CMP and ad serving SDKs that are implemented using native code with Android and iOS. The purpose of the wrapper is to provide and store consent information provided by the CMP. Once the consent information is available, other SDKs can utilize it. The wrapper is designed to work with any CMP or SDK that is following the IAB specifications.

SDK – A software development kit is an ad serving technology (for iOS and Android) provided by Smaato as well as by other vendors as long as it follows the GDPR and Consent Tool Framework as specified by IAB Europe. The Smaato SDK expects that the wrapper and the user consent information are available and stored within.

You can choose a commercially available CMP that adheres to the IAB In-App Mobile Specification, if you do, please follow their guidelines and go directly to step 3 for the Smaato SDK. The following first two steps are only required if you choose to implement the IAB reference implementation.

Step 1: Install and Configure the IAB CMP Reference Implementation

CMP Folder

Place the contents of the CMP folder to the web server directory of your choice.

You can find the folder on GitHub

If you are using Git:

git clone
cd "In-App Reference/Mobile In-App Reference Implementation/"

When using NPM:

npm run build

Next, use Yarn to build the actual CMP:

yarn install
yarn start

It will start a local copy running at:http://localhost:5000/docs/

  • ./build/cmp.bundle.js – CMP script to include on your site
  • ./build/docs/ – Application hosting the documentation

This will produce a production build of the CMP script and the docs application

Configuring Your CMP

Instructions to install the CMP, as well as API docs and examples, are available in the docs application included with the repo.

The CMP tool is ready to use. If you would like to implement an advanced configuration, follow this guide.

Step 2: Install and Configure the In-App Wrapper

Implementation for Android App Publishers

Android App Publisher  –

  • Drag and drop the classes from the cmpconsenttool package to your project. You will have to update the copied classes package name to point to yours, update the import where needed and add the CMPConsentToolActivity to your AndroidManifest.xml

  • Configure the consent tool by providing a set of properties encapsulated in the CMPSettings object. Where: 
    • SubjectToGdpr: Enumeration that indicates;
Enum Value Subject to GDPR?
CMPGDPRDisabled  = 0 Not Subject
CMPGDPREnabled = 1 subject to GDPR
CMPGDPRUnknown = -1 Unset or Unknown
    • consentToolURL: String url that is used to create and load the request into the WebView – it is the request for the consent webpage. This property is mandatory.
    • consentString: If this property is given, it enforces reinitialization with the given string, configured based on the consentToolURL. This property is optional.
CMP Settings  = new CMPSettings(SubjectToGdpr.CMPGDPREnabled, “https://consentWebPage”, null);
  • In order to start the CMPConsentToolActivity, you can call the following method:

CMP Wrapper Implementation Guide for iOS App Publishers

iOS App Publisher  –

  • Configure the consent tool by providing a cosentToolURL to CMPConsentToolViewController.
    • consentToolURL: NSURL
      • This is used to create and load the request into the WKWebView – it is the request for the consent webpage. This property is mandatory.

      • strong>cmpPresent:BOOL

    • CMPConsentToolViewControllerDelegate
      • The delegate consentToolViewController: didReceiveConsentString: will be called once consent tool receives base-64 encoded string from given consentToolURL.
  • You can configure subjectToGDPR available in CMPConsentToolAPI and once you have it set, it will be stored automatically to NSUserDefaults. It is accessible through object of CMPConsentToolViewController.

    • SubjectToGDPR: Enumeration that indicates;

Enum Value Subject to GDPR?
SubjectToGDPR_No  = 0 Not Subject
SubjectToGDPR_Yes = 1 subject to GDPR
SubjectToGDPR_Unknown = -1 Unset or Unknown
  • consentString: If this property is given, it enforces re-initialization with the given string when configured based on the consentToolURL. If this is not set by the publisher, it will be fetched from NSUserDefaults if available. This property is optional.
#import "CMPConsentToolViewController.h"

@interface  ViewController () <CMPConsentToolViewControllerDelegate>

- (void)viewDidLoad {
	[super  viewDidLoad];

	CMPConsentToolViewController *consentToolVC = [[CMPConsentToolViewController  alloc] init];
	consentToolVC.consentToolURL = [NSURL  URLWithString:@"consent tool URL"];
	consentToolVC.consentToolAPI.cmpPresent = YES;
	consentToolVC.consentToolAPI.subjectToGDPR = SubjectToGDPR_Yes;
	consentToolVC.delegate = self;
	[self  presentViewController:consentToolVC animated:YES  completion:nil];

-(void)consentToolViewController:(CMPConsentToolViewController *)consentToolViewController didReceiveConsentString:(NSString *)consentString {
	[consentToolViewController dismissViewControllerAnimated:YES  completion:nil];
	// your code
  • Once the base-64 consent string is returned by consentToolURL, it will be stored automatically to NSUserDefaults along with parsedVendorConsents and parsedPurposeConsents. These properties are available with CMPConsentToolAPI class.
  • To access purpose consent for given purposeId, isPurposeConsentGivenFor: can be used. Return type is YES if is consent given, or the return type will be set to NO.
int purposeId = <purpose id>;
BOOL purposeConsent = [consentToolViewController.consentToolAPI isPurposeConsentGivenFor:purposeId];
  • To access vendor consent for given vendorId isVendorConsentGivenFor: can be used. Return type is YES if is consent given, or the return type will be set to NO.
int vendorId = <vendor id>;
BOOL vendorConsent = [consentToolViewController.consentToolAPI isVendorConsentGivenFor:vendorId];

Step 3: Install and Integrate the Smaato SDK

For Android, follow the steps outlined in the Smaato Android SDK pages.

For iOS, follow the steps outlined in the Smaato iOS SDK pages.

Modified: June 13, 2019 at 11:14 am