Integrate AppsFlyer with Salesforce Marketing Cloud (SFMC) to deep link users from email campaigns to in-app content. Sync in-app event data into SFMC to build audiences and trigger journeys based on real app behavior.
About the integration
SFMC lets you re-engage existing users through email campaigns by deep linking them to specific in-app content, such as a promotion or a personalized offer.
There are two integration options:
- Standard SFMC email deep linking: create your campaign OneLink links in AppsFlyer, then add them to your emails.
- Advanced SFMC app exchange integration: create campaign OneLink links directly inside Salesforce, and automatically import in-app event data so you can build re-engagement audiences. This is a premium feature.
Comparison: Standard vs. Advanced
| Capability | Standard SFMC email deep linking | Advanced SFMC app exchange integration |
|---|---|---|
| Deferred deep links | Yes | Yes |
| Direct deep links | Yes | Yes |
| Deep link measurement | Yes | Yes |
| Link creation | In AppsFlyer | In the dedicated Salesforce app |
| SFMC postbacks (in-app event sync) | No | Yes |
Prerequisites
iOS
- AppsFlyer iOS SDK version 4.9.0+
- For iOS Universal Links, do the following in your SFMC environment: Purchase and implement a Sender Authentication Package (SAP), and purchase an SSL Certificate (SSL Configuration) and submit an SSL Request Form. Reach out to your Salesforce account representative or submit a deliverability support case via Salesforce Help to get both.
Android
- AppsFlyer Android SDK version 4.9.0+
- SFMC doesn't support Android App Links, so URI Scheme deep linking is used instead. No special action is needed to support deep linking in Android apps from SFMC.
Set up Standard SFMC email deep linking
To set up the integration:
Step 1: Set your click-recording domain in SFMC
To set a click-recording domain, follow SFMC official guides for:
Step 2: Upload your SSL certificate to SFMC
In order for iOS Universal Links to work properly, your click-recording domain must include your domain's SSL certificate that should be installed in your SFMC account. Instructions on setting your SSL certificates can be found in the SFMC official guide.
Step 3: Set deep linking in SFMC
To enable deep linking from SFMC emails:
- Log in to your SFMC account, and go to the Email Studio view
- Click on the Admin tab
-
In the side menu, click on deep linking. In this view, you can configure new deep link integration with your app, or modify existing ones.
-
To create a new configuration, click the Create button and enter your AppID. The AppID value is a combination of your Apple developer team ID and the Bundle ID. Both of these values can be retrieved from your Apple Developer account.
Example
Given the Team ID prefix 5UABCDFGH and the Bundle ID com.your.app, the following value should be entered:
5UABCDFGH.com.your.app -
Your set up of universal links and deep linking is completed once SFMC sets up the Apple App Site Association (AASA) file. This process may take a few hours. You can see your generated file using the following URL:
https://<click_recording_link_domain>/apple-app-site-association
Step 4: Configure your AppsFlyer SDK
Note
If you haven't already done so, make sure to configure your app to support deep linking with OneLink.
After configuring your click-recording domain to support Universal Links as described previously, you need to set up your app to deep link and resolve the Universal Link.
-
Associate the click-recording domain in Xcode:
-
Provide the click-recording domain to the SDK API
setResolveDeepLinkURLs. This API needs to be called before SDK initialization. For more information, see the SDK documentation on resolving deep link URLs.AppsFlyerLib.shared().resolveDeepLinkURLs = ["example.com", "click.example.com"]-
Important! If you are using Movable Ink (MI) in conjunction with Salesforce, you need to get the MI CNAME and internal domains from your MI account manager and add them to
setResolveDeepLinkURLs, in addition to the click link for Salesforce. For example:AppsFlyerLib.shared().resolveDeepLinkURLs = ["salesforce-click.example.com", "mi.example.com", "example.micpn.com"]
-
- When the app is invoked due to a click on the Universal Link, the AppsFlyer SDK resolves the deep link and extracts the underlying OneLink. All deep link parameters are then propagated into the onAppOpenAttribution API for deep link logic execution.
Send emails with Standard SFMC email deep linking
To send emails with Standard SFMC email deep linking:
- Create a OneLink link, either manually or from the OneLink links page in the AppsFlyer dashboard.
- URL-encode all parameter values when you create the OneLink. These parameters are highly recommended:
| Parameter | Description | Notes |
|---|---|---|
| pid | Media source | Representative media source |
| c | Campaign name | The campaign that will be attributed |
| af_dp | Deep-link URL | Deep-link redirect for users |
| af_web_dp | Desktop redirect | Redirect for desktop users |
| af_ios_url | Redirect for iOS users who don't have the app installed | |
| af_android_url | Redirect for Android users who don't have the app installed |
- Copy the link into the email you create in Salesforce Email Studio. Salesforce Marketing Cloud wraps the link with your click-recording domain, so any click on that domain redirects to your OneLink attribution link.
Example (URL parameters shown unencoded, for readability):
https://example.onelink.me/ABcd?pid=Email&c=Spring_Newsletter&af_dp=testapp://path/to/content&af_web_dp=https://www.example.com/path/to/content&af_ios_url=https://www.example.com/path/to/content&af_android_url=https://www.example.com/path/to/contentSet up the Advanced SFMC app exchange integration
To set up the advanced SFMC app exchange integration:
Step 1: Install the OneLink app from the SFMC AppExchange
- Ask your CSM, or email hello@appsflyer.com, to enable the app install on the SFMC AppExchange.
- In Salesforce, go to the AppExchange link your CSM shares once the app is enabled.
- Click Install.
- Grant permissions: ask your Salesforce Marketing Cloud admin to grant access to the app for individual users or Business Units. You may need a hard refresh to see the new permissions.
- Give users access to the AppsFlyer OneLink app: go to Apps > Installed Packages, select the ACCESS tab, select the users who should be able to use OneLink, and click Save. Again, a hard refresh may be needed.
Step 2: Complete the basic setup
Complete the steps in the "Set up Standard SFMC email deep linking" above.
Step 3: Create OneLink links in Salesforce using the AppsFlyer OneLink app
Create a separate attribution link for each campaign.
To create a OneLink link:
- In Salesforce, open the AppsFlyer OneLink app.
- Click Add OneLink.
- Enter a name in the Link name field. Consider:
- Choose an easily identifiable name.
- The link name will be used when applying OneLinks to email campaigns.
- In the Base URL field, enter the long-version OneLink URL copied from the AppsFlyer OneLink custom links page.
- Use a long-version URL to make sure the app analyzes and sets link parameters.
- Learn how to copy an existing link URL or create a new OneLink link.
- [Optional] To add more parameters, click Add parameter. See the list of recommended parameters.
- [Optional] To set an internal SalesForce marketing cloud macro, click the icon located to the right of a parameter.
- It is recommended to set a Subscriber key for each OneLink parameter.
- This lets you connect attributed email conversions back to your Salesforce data.
- Click Generate link.
Step 4: Send emails containing custom attribution links
- In Salesforce Email Studio, create a new template or email.
- Click the Edit icon, the Content tab, then select Blocks.
-
Scroll down to find AppsFlyer Button CB or AppsFlyer Image CB.
- Drag the image/button into the body of the email.
- Click the image/button to edit.
- In the Title field, name the image/button.
-
Select a OneLink link.
- Save the email and send it.
Example
For readability purposes, the URL parameters are not URL encoded:
https://example.onelink.me/ABcd?pid=Email&c=Spring_Newsletter&
af_dp=testapp://path/to/content&af_web_dp=https://www.example.com/path/to/content&
af_ios_url=https://www.example.com/path/to/content&af_android_url=https://www.example.com/path/to/content
Step 5: Test your links
To test your attribution links:
- Create the appropriate OneLink URL.
- Place it in an email.
- Send the email to yourself.
- Click the link.
- If you have the app installed on your device, the app should be invoked.
- If the relevant AppsFlyer SDK deep linking APIs are implemented you are deep linked into the relevant content.
- A click should appear in both the AppsFlyer dashboard, attributed to the provided media source and campaign.
- A click appears in Salesforce data.
Dynamic Emails
If you need to generate links dynamically to represent dynamic content per user, use the OneLink API.
To do this, use an Automation Studio script activity in SFMC's Journey Builder that calls the OneLink API before the send, writes the generated deep link into a field on the send Data Extension for each contact, then have the email pull that field with a simple AMPscript lookup.
Advanced SFMC in-app events data sync
This feature lets AppsFlyer automatically send in-app event data from your app to Salesforce Marketing Cloud, where it's stored in a dedicated Data Extension. Use this data to build audiences, trigger journeys, and personalize campaigns based on real app behavior, such as purchases, registrations, or level completions.
This is a premium feature, available as part of the Advanced SFMC app exchange integration.
How it works
When a user performs an in-app event (for example, completing a purchase), AppsFlyer sends a postback to the SFMC connector. The connector writes the event data into a Data Extension in your SFMC account, where each row represents one event for one contact. From there, use SFMC's Journey Builder or Automation Studio to trigger follow-up communications based on that event.
To set up the advanced data sync:
Step 1: Enable postback sending in AppsFlyer
- In AppsFlyer, go to Collaborate > Active Integrations and search for Salesforce Marketing Cloud.
- Select the app you want to configure and click Set up integration.
- In the Integration tab, make sure the Activate partner toggle is on.
- Scroll to In-app event postbacks and turn the toggle on.
- Click Add event and map the AppsFlyer events you want to send to SFMC. For each event, select it from your app's event list and set the sending condition: This partner only (sends only events attributed to SFMC traffic) or All media sources, including organic (recommended for audience building, since it sends every occurrence of the event regardless of attribution).
- Click Save integration.
Only events already received by AppsFlyer from your SDK or S2S integration appear in the event list. If an event is missing, check your SDK implementation first.
Step 2: Verify the Data Extension in SFMC
After the first postback is sent, AppsFlyer automatically creates a Data Extension in your SFMC account, named Installs-{mid} or Events-{mid}. To verify:
- In SFMC, go to Email Studio > Data Extensions.
- Search for your app's Data Extension.
- Confirm rows are populating with event data. Each row should include the contact identifier, event name, event timestamp, and event parameters.
If the Data Extension wasn't created automatically, confirm the SFMC connector app is correctly installed and that your SFMC admin has granted it the necessary data write permissions.
Step 3: Use event data in Journey Builder
- In SFMC, open Journey Builder and create or edit a journey.
- Set the entry source to Data Extension and select the AppsFlyer Data Extension for your app.
- Configure the entry criteria, for example, contacts whose event_name equals af_purchase.
- Build the journey steps you need (send email, wait, branch by event value, and so on).
- Activate the journey.
Use the af_sub1 parameter in your OneLinks to pass the SFMC subscriber key as a user identifier. This lets postbacks match back to the correct contact record in Salesforce, enabling contact-level personalization rather than campaign-level attribution only.
Postback data fields
The SFMC connector creates two Data Extensions in your account: one for installs, one for in-app events. All fields exist in the schema, but some aren't currently populated. Fields marked "not written" are part of the schema but will always be empty.
Data fields
Install Data Extension fields (49 fields)
| Field | Written | Notes |
|---|---|---|
| Touch Type | Yes | |
| Touch Time | Yes | |
| Event Name | Yes | |
| Event Source | Yes | |
| Media Source | Yes | |
| Channel | Yes | |
| Campaign | Yes | |
| Campaign ID | Yes | |
| Sub Param 1 to 5 | Yes | Map to af_sub1 through af_sub5 on the OneLink |
| Region | Yes | |
| Country Code | Yes | |
| State | Yes | |
| City | Yes | |
| Postal Code | Yes | |
| DMA | Yes | |
| IP | Yes | |
| AF ID | Yes | AppsFlyer's unique device identifier |
| IDFV | Yes | |
| Device Type | Yes | |
| Device Cat | Yes | |
| Platform | Yes | |
| OS Version | Yes | |
| App Version | Yes | |
| SDK Version | Yes | |
| App ID | Yes | |
| App Name | Yes | |
| Is Retargeting | Yes | |
| Match Type | Yes | |
| User Agent | Yes | |
| Install Time | Yes | |
| Event Time | Yes | |
| Deep Link Value | Yes | |
| deep_link_sub1 to sub10 | No | Exists in the schema, not written |
| IDFA | No | Exists in the schema, not written (iOS device identifier) |
| Advertiser ID | No | Exists in the schema, not written (Android GAID) |
In-app event Data Extension fields
All install fields above, plus:
| Field | Written | Notes |
|---|---|---|
| Is Primary Attribution | No | Exists in the schema, not written |
| Reengagement Window | No | Exists in the schema, not written |
| Event Value | No | Exists in the schema, not written |
| Event Revenue Currency | No | Exists in the schema, not written |
| Event Revenue USD | No | Exists in the schema, not written |
Troubleshooting
- No data in the Data Extension: Check that the Activate partner toggle and the in-app event postbacks toggle are both on, and that the events you need are mapped. Also confirm the SFMC app has data write permissions in your SFMC account.
- Events appearing but no matching contacts: Make sure you're passing af_sub1=%%subscriberkey%% in your OneLinks, so postbacks can match to SFMC contacts.
- Data Extension not created: Contact your CSM or AppsFlyer support to confirm the connector is correctly provisioned for your account.