Integrating the iOS SDK
This guide describes how to integrate the DT Exchange SDK into your iOS project, which uses CocoaPods for dependency management.
Integrating with CocoaPods
CocoaPods enables you to add and manage external libraries. To integrate via CocoaPods:
Open a terminal and navigate to your project directory.
Run the following command to create a new
Podfileif you don't already have one:
pod initEdit the
Podfileand add the DT Exchange pod to the desired target:
pod 'Fyber_Marketplace_SDK'To install and update the repository, run the following command. The
pod installcommand installs the SDK and its dependencies and creates a new.xcworkspacefile for use with Xcode:
pod install --repo-updateTo import the
IASDKCoreinto theAppDelegateclass, run the following command:
[IASDKCore.sharedInstance setGDPRConsentString:@"abcdef"];Downloading and Setting Up the SDK
To download the DT Exchange iOS SDK, click here:
The DT Exchange SDK zip folder includes a test app that demonstrates the integration process and adds functionality. It shows ads from DT Exchange and troubleshoots issues.
Starting the Process
The DT iOS SDK requires a minimum deployment target of iOS 11 and is fully compatible with iOS 17.
If you use the CocoaPods Dependency Manager, see Integrating with CocoaPods and then refer to Initializing the SDK.
Step 1: Integrating the Libraries
Drag the
IASDKCorelibrary to your Xcode project. The Choose options for adding these files pop-up screen appears.Select the Copy items if needed and Create Groups checkboxes.
From Application target→Build Phases, click Link Binary With Libraries to verify that the app target is linked with the
IASDKCorelibrary.If missing, drag the
IASDKCorelibrary to the Link Binary With Libraries section. This links your project with theIASDKCorelibrary and adds a required path to the Framework Search Paths.Import the
IASDKinto theAppDelegateclass:
Step 2: Initializing the SDK
SDK initialization is mandatory because the DT SDK relies on the console configuration for functionality. Without it, the SDK won't operate, and no ads will display. DT recommends performing this step during the app's initialization.
The following takes place during the initialization phase:
Initialization of SDK.
Remote configuration fetching, parsing, loading, and local configuration update.
Add the following code inside the method in the
AppDelegateclass.
Run the following command:
All Publisher (client-side) Ad Requests are on hold until the configuration is loaded to memory. The requests resume asynchronously once the config is ready. If a timeout occurs, the Publisher receives an ad failed event.
For further information about advanced SDK init integration, see SDK Initialization for DT Exchange SDK.
Step 3: Configuring Apple Requirements
Adhering to Apple's requirements ensures that your app complies with its privacy guidelines, as described in ATS Configuration for DT Exchange SDK.
Configuring Tracking Permission Alerts with ATT Framework
App Tracking Transparency (ATT) allows you to request user consent for tracking. You must use the ATT framework and provide your users with an authorization request within your app only if you want to receive consent and access a non-zero IDFA from the device. For more information, see App Tracking Transparency.
Calling requestTrackingAuthorization(completionHandler:) prompts the end user for app-tracking authorization. If the user disables tracking, the IDFA is set to zero.
SKAdNetwork Attribution Solution
The SKAdNetwork API enables advertisers to measure app installs in a privacy-aware manner. Configuring SKAdNetwork IDs is crucial to monetizing with DT Exchange since it allows DSPs to credit your app with installs. DT recommends that you include SKAdNetwork IDs in the info.plist file to maximize revenue potential.
Getting the SKAdNetwork IDs
The SKAdNetwork IDs for DT and DT buyers are available in two regularly updated formats. Select one of the following links to retrieve the latest SKAdNetwork IDs:
SKAdNetwork IDs in JSON format.
SKAdNetwork IDs in XML format.
Configuring the SKAdNetwork IDs
The SKAdNetwork helps track app installs in a privacy-friendly way. To configure your app with SKAdNetwork IDs:
Select
Info.plistfrom the Project navigator in Xcode.In the property list editor, click Add (+) beside a key and press Return.
In the field, type the key name:
SKAdNetworkItems.From the pop-up menu in the Type column, select Array.
Create an array that contains one dictionary for each of DT's recommended SKAdNetwork IDs with the single-key:
SKAd Network Identifier. The string value for the key is the ad network identifier.
SKAdNetwork ID Manager
The SKAdNetwork IDs Manager tool identifies and manages SKAdNetwork IDs. This tool processes and deduplicates SKAdNetwork IDs for all buyers on DT Exchange and then generates a finalized Info.plist;output for streamlining integration into your app. The tool enables you to add other SKAdNetwork IDs to your final Info.plist file.
DT recommends that you use lowercase text for the ad network identifier string.
To configure SKAdNetwork IDs, see Configuring a Source App.
Step 4: Adding Delegates
Delegates manage various events and interactions related to ads. Depending on your integration, you may need to add the following delegates to your iOS integration:
Global Ad Delegate Protocol
Unit Delegate
Video Content Delegate
HTML / MRAID Delegate
For further information, see Delegate Protocols.
Step 5: Adding User Consent
User consent mechanisms comply with various data protection laws. The following regulations mandate that users' data be handled with explicit consent:
GDPR
The General Data Protection Regulation (GDPR) of the European Union requires you to implement a user consent mechanism. A user could be within the GDPR scope for your app when one or all of the following apply:
The user is currently located in the EU.
The user has registered with the app as an EU resident.
The app is specifically targeted to EU users.
To comply with EU regulations and ensure seamless ad monetization, DT recommends consulting a legal advisor to determine the best approach for your business and using a Consent Management Platform (CMP).
If you haven’t updated to SDK 8.3.1 or later, you need to manually configure consent values with your CMP. The SDK automatically retrieves these values from 8.3.1 and later, eliminating the need for manual setup. For a complete list of CMPs, see the Interactive Advertising Bureau - CMP List.
To incorporate GDPR consent values, run the GDPRConsent API in Boolean format, for example:
Valid values:
True: The user grants consent.False: The user does not grant consent.
Setting Consent String
The user's consent status must be passed to the SDK before the SDK is initialized. When you set a GDPR consent value for a user, DT assumes that the user is subject to GDPR rules, even if the user is outside Europe. If a user updates their consent later, you only need to call the API again with the new value.
To set the GDPR consent string, use the following API:
CCPA
The California Consumer Privacy Act of 2018 (CCPA) protects the personal information of California residents and applies to all companies operating in California. If a California resident uses a mobile app developer's app, CCPA applies to the developer and every company that processes the personal information of the app's users. For more information on CCPA, see IAB CCPA Compliance Framework.
To set the CCPA consent string, use the following API:
DT supports the following values for the US Privacy String:
1---: CCPA does not apply, for example, the user is not a California resident.1YNN: User does NOT opt out, ad experience continues.1YYN: User opts out of targeted advertising.
For more information, see US Privacy IAB documentation.
To clear the CCPA-provided data, pass a nil value and use the following Clear Privacy Setting:
The DT Exchange SDK does not validate the provided CCPA string and passes it as-is.
LGPD
The Brazilian General Data Protection Law, the Lei Geral de Proteção de Dados Pessoais (LGPD), mandates processing personal data for legitimate, specific, explicit, and communicated purposes.
To set the LGPD consent value, use the following API:
Valid values:
IALGPDConsentTypeGiven: User grants consent.IALGPDConsentTypeDenied: User does not grant consent.
If the consent value is not set, the default is no consent.
COPPA
The Children's Online Privacy Protection Act of 1998 (COPPA) is a federal law that imposes specific requirements on websites and online service operators to protect the privacy of children under 13.
COPPA API for Flagging Specific Users
iOS SDK 8.2.1+ supports the COPPA API, which allows publishers to flag specific end users as children as required under COPPA. It is the Publisher's responsibility to decide whether to use the COPPA API or to treat all users as children. For instructions on flagging all users as children, see COPPA.
iOS SDK 8.2.1+ supports the COPPA API, which allows publishers to flag specific end users as children as required under COPPA. It is the publisher’s responsibility to decide whether to use the COPPA API or to treat all users as children. For COPPA configuration options, see COPPA.
Important
Execute the COPPA API after successfully initializing the DT SDK.
Pass the COPPA state after every successful init of the SDK.
To confirm that the target audience of the application applies to COPPA, use the following API:
GPP
The IAB Global Privacy Protocol (GPP) is a standardized framework for managing and transmitting user consent and privacy signals across the digital advertising ecosystem.
GPP is supported starting with iOS SDK 8.4.6. For more information, see GPP.
Step 6: (Optional) Setting User IDs
This section describes how to set a User ID that is cached on the device and does not need to be passed in every session.
Setting a User ID
The User ID is sent as is, without validation or modification.
To reset the User ID on a device, pass a nil or an empty string in the following format.
Setting Introspection (reflection) Integration
To run an integration using introspection (reflection), run the following script:
Last updated
