Postback macros for analytics partners

At a glance: Use macros as part of the postbacks sent to analytics partners to get relevant attribution data.

Postbacks for analytics partners

Analytics partners can define the content and endpoints of postbacks sent to them, as part of their integration with AppsFlyer. Postbacks relate to app user engagement like installs, in-app events, re-engagements, and so on.

  • Postback configuration: To request changes to your postback settings, use the partner assistant widget to open a ticket, or contact your AppsFlyer partner development manager.
  • Postback types: Postbacks are available for install and in-app events.

Postback macros

When included in a postback, macros are replaced with user-relevant data. For example, to get the IP address of the user installing the app, include country_code=(ip) in the postback structure. Supported macros are listed in the following table:

  • Source: Where the data originates from:
    • SDK: AppsFlyer SDK embedded in the app or server-to-server API
    • AF: After processing by AppsFlyer
  • [Base] Macros for all postbacks: Macros relevant to install and in-app event.
  • [Optional] for in-app events as indicated in the column.

Macros—installs and in-app events

Postback marco (name) Source Description [Base] Macros for all postbacks [Optional] In-app events
advertising_id SDK User-resettable device ID, AKA GAID. Also available as: (sha1-advertiserId) Yes  
event_name SDK Name allocated to an event   Yes
event_revenue_USD AF Event value in USD   Yes
event_revenue SDK Event value reported by SDK using event_revenue_currency or currency selected by you.   Yes
event_revenue_currency SDK The event revenue currency code reported in the event or the currency selected by you.   Yes
event_time SDK Event time   Yes
event_value SDK in-app event includes attributes with values, which can be sent entirely on the postback in JSON format. URL encoded using the (encode) macro.   Yes
partner_event_id AF Name/ID of the corresponding event in the partner's platform   Yes
app_name SDK App name set by the advertiser Yes  
appsflyer_id SDK AppsFlyer unique identifier recorded on conversion Yes  
attributed_touch_type AF A flag marking if the attribution occurred due to a view-through (1 = impression, 0 = click) Yes  
country_code AF Country Code using ISO 3166 (alpha-2) Example: US, CN. Yes  
idfa SDK User resettable advertising ID found on iOS devices Also available as: (sha1-idfa) Yes  
idfv SDK Unique identifier per user per vendor on IOS devices Yes  
install_time SDK Install timestamp Yes  
install_unix_ts SDK Install timestamp in unix format Yes  
is_lat SDK Limit ad tracking (LAT): iOS: Starting iOS 14 LAT is deprecated by Apple. Determine user privacy status using ATT. In this case disregard is_lat. Before iOS 14, if true, IDFA is not available and is set to 0. Android: When true, the user has opted-out of interest-based ads. This does not prevent the collection of GAID. Yes  
language SDK Language (locale) reported by the device and set by the device OS. Yes  
app_id SDK Unique app identifier in Appsflyer Yes  
app-version-name SDK App version set by the app developer in the app code Yes  
attributed_touch time AF Time of the touch AppsFlyer attributed to Yes  
device_type SDK The commercial model name of the device. Example: SM-GM284 or iPhone7 Yes  
ip AF IP of the user device reporting the event Yes  
match_type AF Attribution method type. For example, srn, id_matching, probabilistic Yes  
os_version SDK Device operating system version Yes  
user_agent SDK The URL user agent Yes  
wifi SDK If true, the connection was a wifi connection at the conversion time Yes  
oaid SDK User-resettable ID on some Android devices usually as an alternative to GAID Yes  
platform SDK Device platform: iOS, Android, or Windows Mobile Yes  
retargeting_conversion_type SDK A flag marking if this is a re-attribution or re-engagement Yes  
pid AF Ad network that the install or in-app event is attributed to Yes  
af_ad Link Ad Name (see more) provided by the advertiser/publisher Yes Yes
af_ad_id Link Provided by the advertiser/publisher Yes Yes
af_adset Link
  • Provided by the advertiser/publisher.
  • Adset is an intermediate level in the hierarchy between Campaign and Ad. See more
Yes Yes
af_adset_id Link Provided by the advertiser/publisher Yes Yes
c Link Provided by the advertiser/publisher. Campaign names that exceed 100 characters in length are displayed on the dashboard as "c_name_exceeded_max_length" Yes Yes
af_c_id Link Provided by the advertiser/publisher Yes Yes
af_siteid Link
  • Unique ID that identifies the publisher that displays the ad. Learn more
Yes Yes
af_subsite_id Link
  • Ad sub-network/Publisher ID. 
  • If in addition to the main publisher (site ID), there is a sub-publisher, or you want to include additional info, such as ad type/placement within the app, like banner, interstitial, video, etc. use af_sub_siteid. For example: af_sub_siteid =ABCD_4567
Yes Yes
af_ad_type Link

Use the following naming convention:

  • text: an ad unit containing only text, for example a search result
  • banner: a basic format that appears at the top or bottom of the device screen
  • interstitial: a full-page ad that appears during breaks in the current experience
  • video: a standard video, that is non-rewarded
  • rewarded_video: an ad unit offering in-app rewards in exchange for watching a video
  • playable: an ad unit containing an interactive preview of the app experience
  • sponsored_content: a link included in a piece of sponsored content, like an advertorial article
  • audio: an audio ad
Yes Yes

In-app event only macros

The examples that follow relate to in-app event postbacks available to partners.

 Example

Event postback template &event=(event)&json=(encode) was translated to the following postback for a specific af_purchase event:

&event=af_purchase&json=%7B%22af_quantity%22%3A1%2C%22
af_revenue%22%3A%2212000%22%2C%22af_currency%22%3A%22USD%22%2C%22af_content_id%22%3A%221107%22%2C%22af_content_type%22%3A%22default_type%22%7D%0A

The decoded JSON value of this postback is {"af_quantity":1,"af_revenue":"12000","af_currency":"USD","af_content_id":"1107","af_content_type":"default_type"}

Encoded values

Postbacks may contain irregular characters, which are not alpha-numerical. To transfer these values correctly via postbacks, AppsFlyer URL-encodes non-alpha-numerical values.
To decode or encode a postback use an encoding web service.

Sample postbacks

General install postback examples

Android iOS
http://YourCompanyDomain.com?pid=(media_source)&advertising_id=(advertiserId)&android_id=(android-id)&install_time=(install-unix-ts)

General in-app event postback examples

Android iOS
http://YourCompanyDomain.com?pid=(media_source)&device_ip=(ip)&advertising_id=(advertiserId)&android_id=(android-id)&install_time=(install-unix-ts)&event_name=(event-name)&currency=(currency)&json=(event-value)

In-app event postback example

Event Parameters:

  • Event Name: af_revenue
  • Event Revenue: 120.00
  • Event Currency: USD
  • Event Value: {"af_quantity":1,"af_revenue":"120","af_currency":"USD","af_content_id":"1107","af_content_type":"default_type"}

Postback:

http://YourCompanyDomain.com?pid=(media_source)&device_ip=38.166.144.142&advertising_id=121sxxxx-xxxx-xxxx-xxxx-52454bd7500b&android_id=9aaeecc4455xxxxx&install_time=1451923560&event_name=af_purchase&currency=USD&revenue=120.00&json=%7B%22af_quantity%22%3A1%2C%22 />af_revenue%22%3A%22120.10%22%2C%22af_currency%22%3A%22USD%22%2C%22af_content_id%22%3A%221107%22%2C%22af_content_type%22%3A%22default_type%22%7D%0A