The Sourcepoint Native Message API allows your developers to integrate consent management capabilities into your mobile apps while still allowing campaign management to be handled by non-technical users. 

This API will allow developers to build native consent experiences for their users that include both IAB concepts for the TCF v2 (Vendors, Purposes, Features, Special Features, Special Purposes) as well as non-IAB, custom purposes and vendors.

  Note: The documentation to set native message first layer and privacy managers can be found in our article Native App Messages - Message Builder. This step is required to complete the setup.

Please refer to the complete native message documentation in the Sourcepoint Github resource centre for iOS and Android.


App setup

In your app code your developers will need to specify the ids for account, campaign, property and the property name. In the class ViewController you will need to update these values in the code:

Parameter Description Example value
accountId The account id of your organization 22
propertyName The property name as shown in the Sourcepoint portal dashboard tcfv2.mobile.demo
gdprPMId The id of the GDPR property manager 566358
ccpaPMId The id of the CCPA property manager 566360
iOS code Android code

  Note: This code sample is from Sourcepoint's iOS app resource page on Github.

import UIKit
import Foundation
import ConsentViewController

class ViewController: UIViewController {
   var idfaStatus: SPIDFAStatus { SPIDFAStatus.current() }
   let myVendorId = "5f23e826b8e05c0c0d4fdb8f" // sourcepoint vendor id
   let myPurposesId = [
      "61767550ee493f0617946a3e", // Store and/or access information on a device
      "61767550ee493f0617946a5b", // Select personalised content
      "61767550ee493f0617946a66", // Measure content performance
      "61767550ee493f0617946a71"  // Develop and improve products
   ]
   let accountId = 22
   let propertyName = try! SPPropertyName("ios.native.demo")
   let campaigns = SPCampaigns (
      gdpr: SPCampaign(),
      ccpa: SPCampaign(),
      ios14: SPCampaign()
   )
   let gdprPMId = "566358"
   let ccpaPMId = "566360"

   @IBOutlet weak var idfaStatusLabel: UILabel!
   @IBOutlet weak var myVendorAcceptedLabel: UILabel!
   @IBOutlet weak var acceptMyVendorButton: UIButton!
   @IBOutlet weak var gdprPMButton: UIButton!
   @IBOutlet weak var ccpaPMButton: UIButton!

   var messageController: NativeMessageViewController!

   @IBAction func onNetworkCallsTap(_ sender: Any) {
      NotificationCenter.default.post(name: NSNotification.Name(rawValue: "wormholy_fire"), object: nil)
   }

   @IBAction func onClearConsentTap(_ sender: Any) {
      SPConsentManager.clearAllData()
      updateUI()
   }

   @IBAction func onGDPRPrivacyManagerTap(_ sender: Any) {
      consentManager.loadGDPRPrivacyManager(withId: gdprPMId)
      showSpinner()
   }

   @IBAction func onCCPAPrivacyManagerTap(_ sender: Any) {
      consentManager.loadCCPAPrivacyManager(withId: ccpaPMId)
      showSpinner()
   }

   @IBAction func onAcceptMyVendorTap(_ sender: Any) {
      consentManager.customConsentGDPR (vendors: [myVendorId], categories: myPurposesId, legIntCategories: []) { 
         [weak self] consents in
         let vendorAccepted = consents.vendorGrants[self?.myVendorId ?? ""]?.granted
         self?.updateMyVendorUI(vendorAccepted)
      }
   }

   lazy var consentManager: SPConsentManager = { SPConsentManager(
      accountId: accountId,
      propertyName: propertyName,
      campaigns: campaigns,
      delegate: self
   )}()

   override func viewDidLoad() {
      super.viewDidLoad()
      updateUI()
      consentManager.loadMessage()
   }
}

Use of the Native Message API may require the developer to persist some state information like:

  • User identifiers
  • Campaign related metadata
Was this article helpful?
0 out of 0 found this helpful