SDK provides an optional Consent Collection feature or CMP. The SDK currently implements TCF v2. The TC string generated by the SDK is available to callers and can be found in the standard location as per TCF v2 specification.
pod 'YieldloveConsent', '6.2.0' |
$ pod install |
Receive an APPLICATION_NAME
for the app, where you would like to collect consent from users.
Set the application name:
YLConsent.instance.setAppName(appName: "APPLICATION_NAME") |
In your Cartfile add these dependencies (for more info about Cartfile see: https://github.com/Carthage/Carthage):
binary "https://slabs-yieldlove-ad-integration.s3.eu-central-1.amazonaws.com/ios/carthage/YieldloveConsent/YieldloveConsent.json" == 6.2.0 binary "https://slabs-yieldlove-ad-integration.s3.eu-central-1.amazonaws.com/ios/carthage/YieldloveExternalConfiguration/YieldloveExternalConfiguration.json" == 0.19.0 github "https://github.com/SourcePointUSA/ios-cmp-app.git" == 7.0.1 github "mxcl/PromiseKit" == 6.21.0 |
Run carthage update --use-xcframeworks --platform ios
Link downloaded and built .xcframework
s to the project
Simple Consent Message displays a view that contains legal information about how user data are collected and handled. It has two buttons, “Accept All” and “Manage My Options” (exact wording may vary and may appear translated).
To collect consent in this manner call YLConsent.instance.collect()
import YieldloveConsent // ... YLConsent.instance.setAppName(appName: "APPLICATION_NAME") let viewController = UIViewController() YLConsent.instance.collect(viewController: viewController, delegate: self) // or with AuthId let options = ConsentOptions() options.authId = "uniqueAuthId" YLConsent.instance.collect(viewController: self, delegate: self, options: options) // or with language setting let myOptions = ConsentOptions() myOptions.language = .German YLConsent.instance.collect(viewController: self, delegate: self, options: myOptions) |
#import "YieldloveConsent-Swift.h" // ... [YLConsent.instance setAppNameWithAppName:@"appDfpTestCMP"]; ConsentOptions* options = [ConsentOptions new]; options.authId = @"uniqueAuthId"; [YLConsent.instance collectWithViewController: self delegate: self options: options]; |
To react to user actions and manage your app UI use a class that implements ConsentDelegate
protocol and listen for onConsentReady(consents: SPUserData)
callback. To use this method please import ConsentViewController
. If it returns, a consent has been given, and app can resume; it will also contain the consent information returned by SourcePoint. See Reacting to App User Actions for details on how to implement this. Pass ConsentDelegate
as second argument to YLConsent.instance.collect()
.
NOTE: Depending on settings of CMP feature for your app, which are done outside the SDK, Simple Consent Message might not appear if consent has already been given by the user in the past. In such case, calling this method again after consent was provided will NOT show the Simple Consent Message.
Privacy Manager displays a more detailed view, where user can consent to individual purposes of their data collection and handling, and choose to share their data with specific vendors. Usually it is the same view that is also accessible using “Manage My Options” button in the Simple Consent Message view.
To display Privacy Manager call YLConsent.instance.showPrivacyManager()
import YieldloveConsent // ... YLConsent.instance.setAppName(appName: "APPLICATION_NAME") let viewController = UIViewController() YLConsent.instance.showPrivacyManager(viewController: viewController, delegate: consentDelegate) // or with language setting let myOptions = ConsentOptions() myOptions.language = .German YLConsent.instance.showPrivacyManager(viewController: self, delegate: self, options: myOptions) |
#import "YieldloveConsent-Swift.h" // ... [YLConsent.instance setAppNameWithAppName:@"appDfpTestCMP"]; ConsentOptions* options = [ConsentOptions new]; options.variant = @"variant"; [YLConsent.instance showPrivacyManagerWithViewController: self delegate: self options: options]; |
To react to users actions and manage your app UI use a class that implements ConsentDelegate
protocol and listen for onConsentReady(consents: SPUserData)
callback. To use this method please import ConsentViewController
. If it returns, a consent has been given, and app can resume; it will also contain the consent information returned by SourcePoint. See Reacting to App User Actions for details on how to implement this. Pass ConsentDelegate
as a second argument to YLConsent.instance.showPrivacyManager()
.
To show PUR layer, pass variant
parameter into ConsentOptions
object and call collect()
or showPrivacyManager()
. Ask publisher account management for the value of this property.
import YieldloveConsent // ... let options = ConsentOptions() options.variant = "purLayer" // example, not real value YLConsent.instance.showPrivacyManager(viewController: self, delegate: self, options: options) |
Passing a variant will display a different view in the CMP. App will still get notifications through the consentDelegate
, as if it was a usual simple message or privacy manager flow.
After user makes their choices “dismiss” method is called by the SDK on the view controller that was passed into the API call:
func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) |
with values dismiss(animated: true, completion: nil)
This dismisses the view controller that was presented modally and causes the view to disappear, allowing user to carry on using your app. If you do not present the Simple Consent Form or Privacy Manager modally, in a “pop-up” kind of way, you may need to navigate the user back to some other view after they make their choices.
To do this, have a class implement ConsentDelegate
protocol, specifically onSPUIFinished()
method. SDK will call this method every time the user finishes making their choices, either using Simple Consent Message or Privacy Manager.
For example:
import UIKit import YieldloveAdIntegration class AppConsentDelegate: ConsentDelegate { var viewRouter: ViewRouter init(viewRouter: ViewRouter) { self.viewRouter = viewRouter } func onSPUIFinished() { self.viewRouter.currentPage = "homeScreen" } func onError(error: ConsentError?) { print("Consent Error: \(error.debugDescription)") self.viewRouter.currentPage = "homeScreen" } } |
#import "YieldloveConsent-Swift.h" @import ConsentViewController; @interface AppConsentDelegate () <ConsentDelegate> @end @implementation AppConsentDelegate - (void)onConsentReadyWithConsents:(SPUserData *) { // at this point consent is given } @end |
Then pass this class into the delegate
property to the API calls. For example:
let delegate = AppConsentDelegate(viewRouter: viewRouter) YLConsent.instance.collect(viewController: viewController, delegate: delegate) |
or
... let delegate = AppConsentDelegate(viewRouter: viewRouter) YLConsent.instance.showPrivacyManager(viewController: viewController, delegate: delegate) |
Currently the SDK implements the following delegate methods (listeners):
import ConsentViewController // called when the consent view is ready to show public func onSPUIReady() // called when the consent view has been dismissed public func onSPUIFinished() // called when consent is available public func onConsentReady(consents: SPUserData) // called when something wrong happens in the consent view public func onError(error: ConsentError?) /// called when the user takes an action in the SP UI public func onAction(action: SPAction) |
Additionally, onAction(action: SPAction) can be called where action is one of:
case SaveAndExit = 1 case PMCancel = 2 case Custom = 9 case AcceptAll = 11 case ShowPrivacyManager = 12 case RejectAll = 13 case Dismiss = 15 case RequestATTAccess = 16 case IDFAAccepted = 17 case IDFADenied = 18 case Unknown = 0 |
To clear a previously stored consent this method is available:
... let delegate = AppConsentDelegate(viewRouter: viewRouter) clearConsentData(delegate: delegate) ... |
This API method is forwarding to the SourcePoint method customConsentTo
.
The ids passed will be appended to the list of already accepted vendors, categories and leg. int. categories. The method is asynchronous so you must pass a completion handler that will receive back an instance of GDPRUserConsent
in case of success or it’ll call the delegate method onError
in case of failure.
It’s important to notice, this method is intended to be used for custom vendors and purposes only. For IAB vendors and purposes, it’s still required to get consent via the consent message or privacy manager.
import YieldloveConsent ... let customConsentData = CustomConsentData( vendors: ["vendor1", "vendor2"], categories: ["cat1", "cat2"], legIntCategories: ["legacyCat1", "legacyCat2"] ) YLConsent.instance.customConsentTo( customConsentData, completionHandler: { gdprUserConsent in // your code for the callback }, delegate: delegate ) |
Please refer to the original manual in the SourcePoint documentation for more information
If you want to use Authenticated Consent feature, pass authId
parameter into ConsentOptions
object and call collect()
.
let options = ConsentOptions() options.authId = "uniqueAuthId" YLConsent.instance.collect(viewController: self, delegate: self, options: options) |
Currently we do not support Authenticated consent for the Privacy manager flow. Even though is it possible to specify authId
in ConsentOptions
, calling showPrivacyManager(: UIViewController, : ConsentDelegate, : ConsentOptions?)
will not cause authenticated consent to be used.
This is a maintenance release which includes version 7.0.1 of SourcePoint CMP.
API breaking changes:
The following API methods are removed:
collect(: UIViewController, : ConsentDelegate)
collect(: UIViewController, : ConsentDelegate, : String?)
showPrivacyManager(: UIViewController, : ConsentDelegate, : String?)
showPrivacyManager(: UIViewController, : ConsentDelegate, : SPMessageLanguage, : String?)
Instead, please use these API methods:
collect(: UIViewController, : ConsentDelegate, : ConsentOptions?)
showPrivacyManager(: UIViewController, : ConsentDelegate, : ConsentOptions?)
Please see respective section of the manual for description of the ConsentOptions
object.
Fixes bug regarding storing of given consent
Fixes a bug where SDK would sometimes attempt to present a viewController while it was already being presented, causing the app to crash
update external configuration sdk
Breaking change: Renamed class YieldloveConsent to YLConsent
remove Alamofire dependency
solve compiler version warning
Fix dependencies
Add language support
Update external config SDK version.
Maintenance release that includes YL External Configuration 0.9.1 and is compatible with YL AdIntegration 7.1.1
Updated Sourcepoint CMP library to version 6.3.1
Fixed a bug where onConsentReady(consents: SPUserData)
was not called on publisher’s delegate.
Maintenance release. Upgrade to latest version of external configuration dependency.
Support for Xcode 13 in Carthage module. Minimum iOS version is now 11.
Updated SourcePoint ConsentViewController
library to version 6.2.0, the official changelog can be found here
API breaking changes:
In the ConsentDelegate class the following functions have been updated:
onConsentReady(: GDPRUUID, : GDPRUserConsent)
changed to onConsentReady(: SPUserData)
gdprConsentUIWillShow()
changed to onSPUIReady()
consentUIDidDisappear()
changed to onSPUIFinished()
New Feature:
Support for multi campaigns
Added callback method onAction to the delegate to forward certain supported action by SourcePoint
SPActionType.AcceptAll
SPActionType.RejectAll
SPActionType.ShowPrivacyManager
SPActionType.SaveAndExit
SPActionType.Dismiss
SPActionType.PMCancel
SPActionType.RequestATTAccess
SPActionType.IDFAAccepted
SPActionType.IDFADenied
SPActionType.Unknown
Fixed Carthage deployment.
Different variants of Privacy Manager UI can be now configured and shown to app users by passing variant
property to showPrivacyManager()
API method
Build for backward compatibility
Add support for AuthId
Upgrade Alamofire to v5
Maintenance release. Changed project structure.
Bumped YieldloveExternalConfiguration dependency to 0.4.0
Add Objective-C support
API breaking changes:
In collect(: UIViewController, : ConsentDelegate)
and showPrivacyManager(: UIViewController, : ConsentDelegate)
methods the second parameter delegate
is now mandatory
Dropped manual configuration support for setting consent properties, only External Configuration is supported
New supported API Method:
Added a new method to clear the previously stored consent: clearConsentData(: ConsentDelegate)
Bugfixes:
The method customConsentTo()
correctly invokes the completionHandler
Minimum iOS version is now iOS 10
Stability improvements and fixes to Consent and PM
API breaking changes:
onConsentReady
now passes through the consent information received from SourcePoint, the signature of the method has changed