Advertising identifier - How to get started

The Plot Plugin makes it possible to offer better targeted advertisements and improved extensive segmented reporting by looking at the user's behavior in other apps by correlating using an Advertising Identifier, often called as IDFA on iOS and Advertising ID on Android.

The Advertising Identifier can be set in the Plot Plugin version 1.10.0 and higher. The advantage for the end user is that it allows more relevant notifications in the future. Both on iOS and on Android have a standardized mechanism that allows collecting information about the user in a non-intrusive way. It is not required to make use of the Advertising Identifier to segment your users. Read more about that in Segmentation - How to get started.


On both iOS and Android, it is possible for end-users to opt-out from the Advertising Identifier. In iOS this functionality is available since version 6 and on Android this is part of Google Play Services version 4.0

We store the Advertising Identifier when the identifier is shared with us as explained in this guide and the end-user has not opted-out. We combine this identifier with the notifications they have received and opened, and with their segmentation values.

To make use of an Advertising Identifier, often abbreviated as Advertising ID in Android, you can use the Google Play Services and use the code snippet like below after you have initialized the Plot Plugin.


// Do not call this function from the main thread. Otherwise, 
// an IllegalStateException will be thrown.
public void setAdvertisingIdThread() {
  try {
    Info adInfo adInfo = AdvertisingIdClient.getAdvertisingIdInfo(mContext);
    String advertisingId = adInfo.getId();
    boolean limitAdTracking = adInfo.isLimitAdTrackingEnabled();
    Plot.setAdvertisingId(advertisingId, limitAdTracking);

  } catch (IOException e) {
    // Unrecoverable error connecting to Google Play services (e.g.,
    // the old version of the service does not support getting AdvertisingId).   
  } catch (GooglePlayServicesRepairableException e) {
    // Encountered a recoverable error connecting to Google Play services.
  } catch (GooglePlayServicesNotAvailableException e) {
    // Google Play services is not available entirely.

Google has an usage policy for when using the Advertising ID. The app has to comply with the policy for it to be allowed in the Play Store.