Example #1
0
  public static void setAppEventAttributionParameters(
      JSONObject params,
      AttributionIdentifiers attributionIdentifiers,
      String anonymousAppDeviceGUID,
      boolean limitEventUsage)
      throws JSONException {
    if (attributionIdentifiers != null && attributionIdentifiers.getAttributionId() != null) {
      params.put("attribution", attributionIdentifiers.getAttributionId());
    }

    if (attributionIdentifiers != null && attributionIdentifiers.getAndroidAdvertiserId() != null) {
      params.put("advertiser_id", attributionIdentifiers.getAndroidAdvertiserId());
      params.put("advertiser_tracking_enabled", !attributionIdentifiers.isTrackingLimited());
    }

    params.put("anon_id", anonymousAppDeviceGUID);
    params.put("application_tracking_enabled", !limitEventUsage);
  }
  public static void setAppEventAttributionParameters(
      GraphObject params,
      AttributionIdentifiers attributionIdentifiers,
      String hashedDeviceAndAppId,
      boolean limitEventUsage) {
    // Send attributionID if it exists, otherwise send a hashed device+appid specific value as the
    // advertiser_id.
    if (attributionIdentifiers != null && attributionIdentifiers.getAttributionId() != null) {
      params.setProperty("attribution", attributionIdentifiers.getAttributionId());
    }

    if (attributionIdentifiers != null && attributionIdentifiers.getAndroidAdvertiserId() != null) {
      params.setProperty("advertiser_id", attributionIdentifiers.getAndroidAdvertiserId());
      params.setProperty(
          "advertiser_tracking_enabled", !attributionIdentifiers.isTrackingLimited());
    } else if (hashedDeviceAndAppId != null) {
      params.setProperty("advertiser_id", hashedDeviceAndAppId);
    }

    params.setProperty("application_tracking_enabled", !limitEventUsage);
  }