CARBON Snippet

Overview

CARBON Snippet enables you to aggregate your mobile app users for the purposes of analyzing and enriching user data. This facilitates a better understanding of your audiences, engaging them through effective marketing campaigns and efficiently providing product or places recommendations.

This document is intended for the mobile app developer. The instructions below explain how to trigger the Pixel by leveraging NATIVE Implementation or simulating a pixel fire via WebView within your App.

For mobile apps using WebView, developers can use the regular web approach of triggering pixels with an HTTP call to CARBON’s servers, in the form of <script> tag loaded on your website.

For Native apps without WebView, developers can manually generate pixels that triggers within their apps by constructing and sending HTTP requests. However, developers will need to populate the HTTP call to the CARBON Pixel server with IDFA and/or Android AID.

Mobile OS requirements

To determine users across apps, CARBON uses device specific advertising identifier provided by the mobile OS, known as IDFA on the iOS and AAID on Android.

For your app to use these advertising identifiers, the following OS versions are required:

  • iOS: iOS 7 or later.
    • iOS 10: IDFA is not available, if Limit Ad Tracking is enabled.
  • Android: Android 4.0 or later
    • Your app must include the Google Play Services SDK to retrieve the AAID (and, therefore to fire CARBON Pixels).
    • Android apps using the AAID must include a privacy policy. See this page

Pixel Parameters

For each method of implementing pixels in mobile apps described in this document, a developer will need to know the following.

Field Required? Description Format
ifa Required IDFA iOS (apple devices) or AAID for Android devices String
device_ip Optional String
ADDITIONAL_PARAMETERS Optional Additional information to send to TerminalOne at the time of pixel fire. String. URL-encoded string of parameters (e.g. "v1=data1&v2=data2&s1=data3")

Additional Parameters

Additional parameters can be used for

  • Collating details such as internal id of a user for additional matching and data enrichment (Especially useful for use-cases related to brand or place recommendations).

Native Implementation on iOS

To fire CARBON pixel on iOS devices without SDK, do the following in your app’s code:

  • Request the iOS identifier for Advertising (IDFA)
  • Prepare the Pixel URL for the HTTP request using the template obtained when setting up the account. (An example looks like this: https://pixel.zprk.io/v4/pixel/3/6/event?ifa=<IDFA>&device_ip=<IP>)
  • Send the HTTP request to fire the pixel by instantiating a hidden UIWebView or WKWebView.

Native iOS

Example
  1. import AdSupport
  2. ...
  3. let myIDFA: String?
  4. // Check if "Limit Ad Tracking" is Enabled
  5. if ASIdentifierManager.sharedManager().advertisingTrackingEnabled {
  6.   // use the IDFA
  7.   myIDFA = ASIdentifierManager.sharedManager().advertisingIdentifier.UUIDString
  8. }
  9. else {
  10.   // use a random UUID
  11.   myIDFA = NSUUID().UUIDString
  12. }

Native Implementation on Android:

To fire the CARBON pixel on Android devices, follow these steps in your app’s code.

Native Android

Example
  1. import com.google.android.gms.ads.identifier.AdvertisingIdClient;
  2. AdvertisingIdClient.Info adInfo = null;
  3. String my_AAID = null;
  4. try {
  5.   adInfo = AdvertisingIdClient.getAdvertisingIdInfo(context);
  6.   // Check for "Limit Ad Tracking".
  7.   if (adInfo.isLimitAdTrackingEnabled()){
  8.     //If LimitTrackingEnabled use a random UUID.
  9.     my_AAID = UUID.randomUUID().toString();
  10.   }
  11.   // use the AAID.
  12.   my_AAID = adInfo.getId();
  13. }
  14. catch (Exception e) {
  15.   // Handle exception if any.
  16. }

Getting Support

If you have any questions on how to integrate CARBON snippet in your app, please feel free to contact us at support@carbonplatform.com.