Mobile Plugins for Native SDKs

US Privacy String

The IAB Tech Lab’s US Privacy String communicates signals regarding consumer privacy and choice under US privacy regulation. Version 1 supports requirements made under the California Consumer Privacy Act (CCPA).

The Ketch US Privacy String plugin for our Native iOS and Android SDKs will generate an appropriate US Privacy String based on the IAB documentation.

iOS

Enabling the plugin

To enable the plugin on Android, you can use the code below as an example.

ketch.add(plugins: [CCPA()])

The Ketch Plugin stores the US Privacy String in the standard NSUserDefaults under the key IABUSPrivacy_String as specified in the IAB documentation.

Testing the plugin

To verify the plugin is running as expected and storing the value as expected, you can follow the steps below.

In Xcode:

  • Open Devices and Simulators screen by going to Window -> Devices and Simulators

  • Go to the simulators tab and select the simulator you are testing with.

  • Copy the devices identifier

  • Open a terminal window and change to the simulators directory. Replacing <simulator_id> with the identifier copied in the previous step.
    /Users/<user.name>/Library/Developer/CoreSimulator/Devices/<simulator-id>/
    note: based on where your terminal starts, you may only use part of the directory structure above when changing to the directory.

  • Find NSUserDefaults file location by running the following command in your terminal replacing <bundle_identifier> with your apps identifier and copy the files location.
    find . -name "<bundle_identifier>.plist"

  • Run the command below to open the file replacing the path after the open with what was copied in the previous step.
    open ./data/Containers/Data/Application/3C49D46C-976A-472B-B915-DDE346B4D3F2/Library/Preferences/<bundle_identifier>.plist

  • Verify the key IABUSPrivacy_String is in there and the value matches what it should based on your configuration within Ketch.

Android

Enabling the plugin

To enable the plugin on Android, you can use the code below as an example.

In the example the code references a PreferenceService class which is responsible for saving and retrieving the US Privacy String from the SharedPreferences on the device as specified in the IAB doumentation. If you already have a mechanism built in to your app to do this, it is recommended to use it and store the value under the key IABUSPrivacy_String. Otherwise, you can find our example here.

...
val preferenceService = PreferenceService(this)

val ccpaPlugin = CCPAPlugin { encodedString, applied ->
    preferenceService.saveUSPrivacyString(encodedString, applied)
}.apply {
    notice = true
    lspa = true
}

ketch.addPlugins(
    ccpaPlugin
)
    ...

Testing the plugin

To verify the plugin is running as expected and storing the value as expected, you can follow the steps below.

In your Android simulator:

  • Open Device Explorer.

  • Select the device you are testing with in the drop down

  • Navigate to the following file: \data\data\<app_package_name>\shared_prefs\

  • Open the file <app_package_name>.xml

  • Verify the key IABUSPrivacy_String is in there and the value matches what it should based on your configuration within Ketch.

TCF

IAB Europe established the TCF to support compliance with the GDPR in the context of digital advertising.

Prescribed use of the TCF may support compliance with the GDPR, but the real benefit to the digital advertising ecosystem is a safer Internet for consumers, and more reliable data for brands and publishers. As adoption of the TCF increases, compliance becomes more scalable and data becomes more meaningful.

The Ketch TCF plugin for our Native iOS and Android SDKs will generate an appropriate TCF String based on the IAB documentation.

iOS

Enabling the plugin

To enable the plugin on iOS, you can use the code below as an example.

ketch.add(plugins: [TCF()])

The Ketch Plugin stores the TC String in the standard NSUserDefaults under the key IABTCF_TCString as specified in the IAB documentation.

Testing the plugin

To verify the plugin is running as expected and storing the value as expected, you can follow the steps below.

In Xcode:

  • Open Devices and Simulators screen by going to Window -> Devices and Simulators

  • Go to the simulators tab and select the simulator you are testing with.

  • Copy the devices identifier

  • Open a terminal window and change to the simulators directory. Replacing <simulator_id> with the identifier copied in the previous step.
    /Users/<user.name>/Library/Developer/CoreSimulator/Devices/<simulator-id>/
    note: based on where your terminal starts, you may only use part of the directory structure above when changing to the directory.

  • Find NSUserDefaults file location by running the following command in your terminal replacing <bundle_identifier> with your apps identifier and copy the files location.
    find . -name "<bundle_identifier>.plist"

  • Run the command below to open the file replacing the path after the open with what was copied in the previous step.
    open ./data/Containers/Data/Application/3C49D46C-976A-472B-B915-DDE346B4D3F2/Library/Preferences/<bundle_identifier>.plist

  • Verify the key IABTCF_TCString is in there and the value matches what it should based on your configuration within Ketch.

Android

Enabling the plugin

To enable the plugin on Android, you can use the code below as an example.

In the example the code references a PreferenecService class which is responsible for saving and retrieving the TC String from the SharedPreferences on the device as specified in the IAB doumentation. If you already have a mechanism built in to your app to do this, it is recommended to use it and store the value under the key IABTCF_TCString. Otherwise, you can find our example here.

...
val preferenceService = PreferenceService(this)

val tcfPlugin = TCFPlugin { encodedString, applied ->
    preferenceService.saveTCFTCString(encodedString, applied)
}

ketch.addPlugins(
    tcfPlugin
)
    ...

Testing the plugin

To verify the plugin is running as expected and storing the value as expected, you can follow the steps below.

In your Android simulator:

  • Open Device Explorer.

  • Select the device you are testing with in the drop down

  • Navigate to the following file: \data\data\<app_package_name>\shared_prefs\

  • Open the file <app_package_name>.xml

  • Verify the key IABTCF_TCString is in there and the value matches what it should based on your configuration within Ketch.