Awin AppsFlyer
From Wiki
Contents |
AppsFlyer App Tracking
Key Features and Limitations
- AWIN postbacks on Appsflyer are global (non-customisable)
- Events tracking - INSTALL and IN-APP postbacks in place for iOS and Android.
- Supports deep-linking and deferred deep-linking
- Appsflyer tracking link – Onelink is able to detect the device type (Android, iOS, desktop etc.) when clicked and redirect the user to a matching destination
Integration Steps
1. Advertiser to implement the SDK
Required parameters within the SDK - In-app purchase
- af_order_id -> populate with order reference
- af_revenue -> populate with order amount
- af_currency -> populate with currency
- af_class -> populate with order commission group code (only if advertiser wants to apply different but single commission group code per order (new - returning customer,..etc)
- awin_cg -> populate with commission group breakdown (to be introduced for commission group breakdown only)
- af_coupon_code -> populate with voucher code (optional)
SDK example: {"af_order_id":"7423732","af_revenue":31.72, "af_currency":"EUR", "af_class": "NEW", "awin_cg": "NEW_NV:10|MP_PRODUCTS:19.99", "af_coupon_code: "FREE20"}
Custom Revenue Setup
AppsFlyer offers the option to override default af_revenue
SDK parameter, which is populated with the total sale amount. This is useful in cases where you want to pass to the SDK the sale amount without the shipping cost, instead of the full sale amount.
This can be done by introducing a new parameter into the SDK, called awin_revenue
, and populate it with your custom revenue amount.
- awin_revenue -> overrides af_revenue
If awin_revenue
is available in the SDK, then the value of this parameter is passed as the sale amount to Awin. No additional configuration is necessary.
If awin_revenue
is missing from the SDK, then the SDK will use af_revenue
. If both af_revenue
and awin_revenue
are missing, then the SDK will use the value 1.00
.
2. Choose Awin from the integrated partners' list
3. General settings
4. In-App Events Settings
- Populate Awin Advertiser ID with Awin advertiser ID
- Enable In-App Events Postback
- Set Sending Option to: Only events attributed to this partner
- Select the events (SDK Event Name) which client wants to track
- Insert Awin commission group code of the event in mapped to partner event field (If you wish to apply a fixed commission group)
If you prefer to apply changing commission group(s) there are 2 possibilities:
For single and changing commission group: populate af_class parameter with the appropriate commission group code. For example: af_class:@"RETURNING" For multiple and changing commission groups: populate awin_cg with the complete commission group breakdown. For example: awin_cg:@"SHOES:25.00|SHIRTS:30.00"
- Under Send Revenue choose Values & Revenue
5. Generate a tracking link
- Populate the value of parameter name
- Enable Re-targeting (Re-attribution)
- Define the loopback window (default 7 days) – it’s the time from click to an install event – If there is no loopback parameter in the tracking URL, it will be always 7 days, however, Awin is able to append the parameter with the desired value (e.g. 30 days).
Tracking Link
Tracking URL structure
- Parameter cks or awc must be populated with click checksum (!!!awc!!!) which will be returned in cks parameter in sread request.
- In order for tracking link to be eligible for attribution following parameter must be added and populated with awin publisher id af_siteid=!!!id!!!
OneLink tracking link (cross-platform)
https://empower.onelink.me/GQnh/?pid=affiliatewindow_int&af_click_lookback=7d&cks=!!!awc!!!&af_siteid=!!!id!!!&is_retargeting=true&af_reengagement_window=30d
Parameter | Requirements |
pid=affiliatewindow_int | Mandatory - For the event to be attributed to Awin |
cks/awc=!!!awc!!! | Mandatory - Awin click ID to be populated with awc |
awinmid | Optional - It will overwrite the MID set on the dashboard |
af_click_lookback=7d | Optional - 7 day attribution window is set on the dashboard by default |
af_siteid=!!!id!!! | Mandatory - To be populated with the Awin publisher ID |
is_retargeting=true | Mandatory - To enable reengagement |
af_reengagement_window=30d | Mandatory - To enable re-engagement (should be same as cookie length of the program on Awin) |
Tracking link iOS
https://app.appsflyer.com/id1136397354?pid=affiliatewindow_int&af_click_lookback=7d&cks=!!!awc!!!&af_siteid=!!!id!!!
Tracking link Android
https://app.appsflyer.com/finance.empower?pid=affiliatewindow_int&af_click_lookback=7d&cks=!!!awc!!!&af_siteid=!!!id!!!
Deep linking and deferred deep linking using OneLink
OneLink allows marketers to create a single deep link that sends every user to the optimal page in an app, from sources across every possible OS, channel and platform.
OneLink™ is a unique AppsFlyer tracking link which advertisers can use to utilize 3 primary features with a single click:
- Device Detection And Redirection: OneLink is able to detect the device type (Android, iOS, desktop etc.) when clicked and redirect the user to a matching destination.
- Deep Linking: If the advertised mobile app is already installed, OneLink is able to support launching the app after click and/or serving the user with personalized content (such as sending a user to a specific activity/page in the app).
- Deferred Deep Linking: If the advertised mobile app is not installed, OneLink is able to support serving a user with personalized content (such as sending a user to a specific activity/page in the app) on the first launch of the app after install.
Parameter | Requirements |
af_dp | Redirect the user to the specified page within the app |
af_force_deeplink | Force deep linking into the activity specified in af_dp value (af_force_deeplink=true) |
af_web_dp | Redirect the desktop user to the specified URL |
af_r | Redirect all users to the single-platform specified URL |
af_android_url | Redirect Android users to a different URL than the app's page on Google Play |
af_ios_url | Redirect iOS users to a different URL than the app's page on App Store |
About deeplinking:
• AWIN supports a URI scheme but doesn’t support the handling of iOS Universal links and Android app link methods of deep linking. This is due to the link wrapping. It applies to any link used within AWIN. To deep link with OneLink via AWIN, you will need to setup the OneLink URL with a URI scheme. Preferably, your app developer should configure the SDK to support HTTP URL as a deep link value. For iOS apps, use the af_force_deeplink=true parameter on the OneLink URL to activate the deep link URI scheme.
• If the URI scheme is filled in the af_dp parameter, the user will consistently be directed to the static page within the app. However, in cases where the app isn't installed, Safari will display an invalid address error. This method does not support dynamic deep linking. Alternatively, if the app developer implements handling for HTTP URLs by converting them into URI schemes that the app can understand (e.g., making them app-readable product destinations), users will be directed to the relevant product page within the app. Notably, this approach avoids displaying an invalid address error in Safari when the app is not installed.
Postbacks
Install postback - iOS and Android
https://www.awin1.com/sread.php?tt=ss&tv=2&type=ai&merchant=$$mfn(coalesce,$$click(awinmid),$$dashboard(merchant))&amount=1.00&ref=(transaction-id)&parts=download:1.00&cks=(coalesce,(awc),(cks))&p1=(platform)&p2=(os-version)&p3=(device-type)&p4=(appsflyer-device-id)&p5=re-engagement:(is-reengage)&p6=re-attribution:(is-reattr)&p30=appsflyer
In-app postback
https://www.awin1.com/sread.php?tt=ss&tv=2&type=ap&merchant=$$mfn(coalesce,$$click(awinmid),$$dashboard(merchant))&amount=$$mfn(if,$$mfn(equals,$$sdk(af_revenue),N%2FA),1.00,$$sdk(af_revenue),false)&ref=$$mfn(coalesce,$$sdk(af_order_id),$$mfn(str,$$sdk(appsflyer-device-id),$$sdk(unix-ts)))&parts=$$mfn(coalesce,$$sdk(af_class),$$sdk(mappediae)):$$mfn(if,$$mfn(equals,$$sdk(af_revenue),N%2FA),1.00,$$sdk(af_revenue),false)&cks=$$mfn(coalesce,$$click(awc),$$click(cks))&cr=$$mfn(coalesce,$$sdk(af_currency),$$sdk(currency))&p1=$$sdk(platform)&p2=$$sdk(os-version)&p3=$$sdk(device-type)&p5=re-engagement:$$sdk(is-reengage)&p6=re-attribution:$$sdk(is-reattr)&p4=$$sdk(country-code)&p7=$$sdk(event-name)&p8=$$sdk(appsflyer-device-id)&p30=appsflyer
Product Level Tracking
To make use of Product Level Tracking on Appsflyer, incorporate the awin_bd
parameter into the purchase event of Appsflyer SDK and fill it with a basket data string.
For additionl information on the basket data string parameters, please visit the Product Level Tracking section of the Advertiser Tracking Guide.
You can see below a basket data string example:
&bd[0]=encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_1|productName_1|productItemPrice_1|productQuantity_1|productSku_1|commissionGroupCode|productCategory_1))
Requirements
- the &bd[x]= should not be encoded
- the rest of the string should be encoded as follows:
- Android: the string must be triple-encoded
- iOS: the string must be double encoded
Android Example
//Data String Structure and Encoding: &bd[0]=encodeURIComponent(encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_1|productName_1|productItemPrice_1|productQuantity_1|productSku_1|commissionGroupCode|productCategory_1))) //Log Example: [[AppsFlyerLib shared] logEvent: AFEventPurchase withValues:@{ awin_bd:@"&bd[0]=AW%25253AP%25257CadvertiserId%25257CorderReference%25257CproductId_1%25257CproductName_1%25257CproductItemPrice_1%25257CproductQuantity_1%25257CproductSku_1%25257CcommissionGroupCode%25257CproductCategory_1%22;}]
If a transaction has multiple products, then concatenate the encoded strings inside the awin_bd
parameters. Example with multiple products (Android):
//Data String Structure and Encoding: &bd[0]=encodeURIComponent(encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_1|productName_1|productItemPrice_1|productQuantity_1|productSku_1|commissionGroupCode|productCategory_1)))&bd[1]=encodeURIComponent(encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_2|productName_2|productItemPrice_2|productQuantity_2|productSku_2|commissionGroupCode|productCategory_2)))&bd[2]=encodeURIComponent(encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_3|productName_3|productItemPrice_3|productQuantity_3|productSku_3|commissionGroupCode|productCategory_3))) //Log Example: [[AppsFlyerLib shared] logEvent: AFEventPurchase withValues:@{ awin_bd:@"&bd[0]=AW%25253AP%25257CadvertiserId%25257CorderReference%25257CproductId_1%25257CproductName_1%25257CproductItemPrice_1%25257CproductQuantity_1%25257CproductSku_1%25257CcommissionGroupCode%25257CproductCategory_1%22&bd[1]=AW%25253AP%25257CadvertiserId%25257CorderReference%25257CproductId_2%25257CproductName_2%25257CproductItemPrice_2%25257CproductQuantity_2%25257CproductSku_2%25257CcommissionGroupCode%25257CproductCategory_2%22&bd[2]=AW%25253AP%25257CadvertiserId%25257CorderReference%25257CproductId_3%25257CproductName_3%25257CproductItemPrice_3%25257CproductQuantity_3%25257CproductSku_3%25257CcommissionGroupCode%25257CproductCategory_3%22;}]
iOS Example
//Data String Structure and Encoding: &bd[0]=encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_1|productName_1|productItemPrice_1|productQuantity_1|productSku_1|commissionGroupCode|productCategory_1)) //Log Example: [[AppsFlyerLib shared] logEvent: AFEventPurchase withValues:@{ awin_bd:@"&bd[0]=AW%253AP%257CadvertiserId%257CorderReference%257CproductId_1%257CproductName_1%257CproductItemPrice_1%257CproductQuantity_1%257CproductSku_1%257CcommissionGroupCode%257CproductCategory_1";}]
If a transaction has multiple products, then concatenate the encoded strings inside the awin_bd
parameters. Example with multiple products (iOS):
//Data String Structure and Encoding: &bd[0]=encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_1|productName_1|productItemPrice_1|productQuantity_1|productSku_1|commissionGroupCode|productCategory_1))&bd[1]=encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_2|productName_2|productItemPrice_2|productQuantity_2|productSku_2|commissionGroupCode|productCategory_2))&bd[2]=encodeURIComponent(encodeURIComponent(AW:P|advertiserId|orderReference|productId_3|productName_3|productItemPrice_3|productQuantity_3|productSku_3|commissionGroupCode|productCategory_3)) //Log Example: [[AppsFlyerLib shared] logEvent: AFEventPurchase withValues:@{ awin_bd:@"&bd[0]=AW%253AP%257CadvertiserId%257CorderReference%257CproductId_1%257CproductName_1%257CproductItemPrice_1%257CproductQuantity_1%257CproductSku_1%257CcommissionGroupCode%257CproductCategory_1&bd[1]=AW%253AP%257CadvertiserId%257CorderReference%257CproductId_2%257CproductName_2%257CproductItemPrice_2%257CproductQuantity_2%257CproductSku_2%257CcommissionGroupCode%257CproductCategory_2&bd[2]=AW%253AP%257CadvertiserId%257CorderReference%257CproductId_3%257CproductName_3%257CproductItemPrice_3%257CproductQuantity_3%257CproductSku_3%257CcommissionGroupCode%257CproductCategory_3";}]