Overview
This article covers the attribution link template and postback URL setup for integrating AppsFlyer with Swaarm. The templates below are suggested starting points - you can add or remove parameters based on your requirements. Once ready, you can either configure the templates yourself in the AppsFlyer partner dashboard, or share them with the AppsFlyer team who will make the necessary changes. Note that some parameters are pulled from the user's click, while others come from the SDK - confirm with AppsFlyer which data collection method applies to your setup.
ℹ️
For the full list of Swaarm macros and postback parameters → Advertiser Tracking Details
For AppsFlyer's supported attribution link parameters → AppsFlyer documentation
For AppsFlyer's postback macros → AppsFlyer postback macros
Attribution Link
The base AppsFlyer attribution link structure is:
https://app.appsflyer.com/{app_id}?pid={media_source}&c={campaign_name}{app_id}- the app's App Store/Itunes ID or Google Play package namepid- your AppsFlyer Partner ID (e.g.yournetwork_int)c- campaign name - use the offer name macro{offer.name}or set it manually
Complete attribution link with Swaarm macros
ℹ️ The templates below are suggested starting points - you're free to add or remove parameters and macros based on your company's specific needs.
https://app.appsflyer.com/com.testapp?pid={yournetwork_int}&af_enc_data={offer.appsflyer_revenue}&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}⚠️ Replace {yournetwork_int} with your own AppsFlyer Partner ID.
Or you can also use the capture below as a template to set the Attribution link on the AppsFlyer platform.
Postback URLs
Install Postback
https://track.{yournetwork}.swaarm-clients.com/postback?publisher_id={Site ID}&rejection_reason={Blocked reason}&rejected_reason_value={Blocked reason value}&country={Country code}&os_name={Platform}&publisher_sub_id={Sub site ID}&click_id={Click ID}In-App Event Postback
https://track.{yournetwork}.swaarm-clients.com/postback?publisher_id={Site ID}&rejection_reason={Blocked reason}&rejected_reason_value={Blocked reason value}&country={Country code}&os_name={Platform}&publisher_sub_id={Sub site ID}&click_id={Click ID}&event_id={Event name}&sale_amount={Event revenue USD}⚠️ Replace yournetwork with your own Swaarm postback domain.
Alternatively, you can also use the capture below as a template to set the Default postback on the AppsFlyer platform:
In-App Event Setup in Swaarm
For Swaarm to track in-app events from AppsFlyer, you need to map the AppsFlyer event name to the offer's event type:
Go to the offer → Edit → Events
On each event, set the Adv. EventType ID to match the AppsFlyer event name exactly (case-sensitive)
⚠️ Adv. EventType ID must be an exact match with the AppsFlyer event value - otherwise the event will not be attributed correctly.
Advanced Privacy Integration
For iOS 14.5+ campaigns where click ID attribution is not available, Swaarm supports privacy postbacks using the PEA chain. → AppsFlyer Advanced Privacy Integration
Passing Costs to AppsFlyer
There are three ways to share your spend (payout) data with AppsFlyer so the advertiser sees accurate cost figures in their dashboard.
Option 1 - Unencrypted Parameters in the Link
Add three parameters to your AppsFlyer tracking link: af_cost_model, af_cost_value, af_cost_currency.
Example:
...&af_cost_model=CPI&af_cost_value={offer.weGet}&af_cost_currency=USDℹ️ Simplest to set up, but the cost values are visible in plain text in the URL.
Option 2 - Encrypted (af_enc_data)
Same three values, but combined and encrypted into a single af_enc_data parameter instead of appearing individually in the link.
Request your network's encryption key from AppsFlyer's Partner Solutions Engineering team via the partner assistant widget.
Add the key in Swaarm under Settings → Connections → Appsflyer → Payout Encryption.
Once configured, Swaarm automatically encrypts and sends the combined cost data via
af_enc_datainstead of the three separate plain-text parameters.
Example:
...&af_enc_data={offer.appsflyer_revenue}Option 3 - InCost API
For per-advertiser cost reporting via API rather than the tracking link, use AppsFlyer's InCost API. This requires your network to first be set up as an InCost API partner with AppsFlyer (apply via Help → Contact our team → Enabling cost measurement), and each advertiser individually enabling Get Cost Data for your network in their AppsFlyer account.
Full setup guide: AppsFlyer Network Cost Upload




