Skip to main content

AppsFlyer Integration with Swaarm: Advanced Privacy (PEA Chain)

How to set up PEA Chain attribution alongside regular click ID attribution for AppsFlyer integration on iOS 14.5+.

Overview

AppsFlyer's Advanced Privacy (AP) framework controls what data is shared with ad networks for users running iOS 14.5+. When a user doesn't grant ATT consent, click ID-based attribution may not be available. To ensure attribution still works in these cases, Swaarm's PEA Chain token should be passed in the tracking link alongside regular click ID attribution. This way both attribution methods work in parallel — regular attribution is used when available, and PEA Chain is used as a fallback.

ℹ️


Required Tracking Link Parameters

When ATT authorization is not available from a user running iOS 14.5+, the tracking link must include the following parameters so AppsFlyer can perform probabilistic attribution:

Parameter

Description

Swaarm Macro

Example

af_ip

IP address of the user at click time

{user.ip}

102.109.100.2

af_ua

URL-encoded user agent string

{user.encoded_ua}

Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1...)

af_lang

Language of the user's device as defined in HTTP headers

{user.language}

EN

af_model

Device model of the user

{user.model}

GM-9621 / iPhone14

af_os_version

OS version of the user's device

{user.os_version}

9.2.2 / 18.6.2

ℹ️ For S2S tracking, the publisher needs to pass user_ip, user_ua, and user_language in the tracking link for these macros to be populated correctly.


Attribution Link

In addition to the required parameters above, add {pea.chain} to your tracking link in a parameter your advertiser can return in the postback. The recommended parameter is af_adset, but af_sub_siteid or af_ad can also be used depending on the advertiser's requirements.

⚠️ Keep the regular clickid parameter in place - do not remove it. Both attribution methods should coexist in the same tracking link.

ℹ️ Total URL length must not exceed 2000 characters.

Complete tracking link example:

https://app.appsflyer.com/com.testapp?pid=Media_int&af_enc_data={offer.weGet}&af_ip={user.ip}&af_lang={user.language}&af_ua={user.encoded_ua}&af_model={user.model}&af_os_version={user.os_version}&af_siteid={publisher.id}&af_sub_siteid={publisher.subId}&c={offer.name}&af_c_id={offerId}&af_ad={publisher.creative}&af_adset={pea.chain}&clickid={id}&advertising_id={device.ids.gaid}&idfa={device.ids.idfa}

ℹ️ In this example af_adset is used to pass {pea.chain}. The parameter you use must match what AppsFlyer returns in the postback macro.


Postback URLs (AppsFlyer side)

You need to add two sets of postback URLs in AppsFlyer - one for regular attribution (existing) and one for Advanced Privacy (new). Keep the regular postback in place and add the AP postback alongside it.

The only mandatory parameter Swaarm requires from the AP postback is pea_chain.

❗ Replace yournetwork in the postback domain with your own Swaarm postback domain.

Install postback (AP):

https://track.yournetwork.swaarm-clients.com/postback?publisher_sub_id={Sub site ID}&country={Country code}&install_finish_time={Install timestamp}&click_timestamp={Click timestamp}&pea_chain={Adset}&conversion_timestamp={Timestamp}&postback_id={Postback ID}&os_name={Platform}&sale_amount={Event revenue USD}&rejected_reason_value={Blocked reason value}&rejection_reason={Blocked reason}

In-app event postback (AP):

https://track.yournetwork.swaarm-clients.com/postback?publisher_sub_id={Sub site ID}&country={Country code}&install_finish_time={Install timestamp}&click_timestamp={Click timestamp}&pea_chain={Adset}&conversion_timestamp={Timestamp}&postback_id={Postback ID}&os_name={Platform}&sale_amount={Event revenue USD}&event_id={Event name}&rejected_reason_value={Blocked reason value}&rejection_reason={Blocked reason}

ℹ️ {Adset} is the AppsFlyer macro that returns the value passed in the af_adset parameter of the tracking link - this is how the PEA Chain gets returned in the postback. If you used a different parameter (e.g. af_ad), replace {Adset} with the corresponding AppsFlyer macro for that parameter.

Alternatively, you can also use the capture below as a template to set the Advanced privacy postback on the Appslfyer platform.


Publisher Side Changes

To ensure attribution information is correctly forwarded to your publishers for offers with limited AppsFlyer attribution, the tracking links and postbacks on the publisher side need to be adjusted accordingly.

⚠️ Publisher postbacks should be added in addition to any existing postbacks - not as replacements. Replacing existing postbacks will cause lost attributions for your publishers.

The setup depends on which platform your publisher is using:

Did this answer your question?