MGID S2S Conversion Tracking With AppsFlyer (With a Landing Website)

Flow 2: Link to a Landing Page (WITH Custom Dev)  

The flow does require Custom Dev.

Enable the MGID Integrated Partner in AppsFlyer 

  1. Log into the AppsFlyer dashboard: https://hq1.appsflyer.com/auth/login 
  2. Click on My Apps (top, right). 
  3. Start typing the relevant App ID and click on the thumbnail to open the App:

4.Under Configuration (bottom, left), select Integrated Partners. 

5. Start typing “MGID” and click on the thumbnail to open the MGID Partner. 

6. Under MGID Integration, toggle Activate Partner to ON: 

7. Under the Attribution Link tab, locate the Click-Through Attribution section and set the Click-Through Lookback Window to the desired duration - e.g. 30 days:

Useful links:

● https://support.appsflyer.com/hc/en-us/articles/360000844778-PartnerActivation#Partner-Activation  

● https://support.appsflyer.com/hc/en-us/articles/207033816#partner-setup-integration-tab  

● https://support.appsflyer.com/hc/en-us/articles/212955423-Partner-Login-Beta-  

● https://support.appsflyer.com/hc/en-us/articles/207377436-Adding-a-New-App-to-theAppsFlyer-Dashboard  

● https://support.appsflyer.com/hc/en-us/articles/115005248543-OneLink-overview

(Optional) Create in-app events in AppsFlyer 

The steps taken in the previous section allow you to track Install Events. This section describes how to track In-App Events

In-App Event Tracking allows for granular campaign optimization.

If you followed the previous section, you already have the necessary pane open - skip to Step 3. 

1.Open the AppsFlyer dashboard. 

2. Select the relevant App and navigate to Integrated Partners > MGID (see the previous section: Enable the MGID Integrated Partner).

3. Under the Integration tab, enable In-App Events Postback.

4. Under Sending Option, select 'This partner only'. 

5. For each in-app event (aka SDK Event Name) fill in an MGID version of the event name (aka Partner Event Identifier):

Guidelines: 

● Event names are case-sensitive.

● They cannot contain spaces and other special symbols. The name can be ONLY a combination of A-Z letters and numbers.

● Use similar names to the SDK Event Names shown in the AppsFlyer dashboard. 

● Identical names will be used later when creating in-app events in MGID (below)

A useful link:

https://support.appsflyer.com/hc/en-us/articles/208439256-In-app-events-postbackconfiguration

Set up 2 links

 Edit the campaign creative. 

Link the Campaign Creative directly to your Landing Page:

  1. Log into MGID Ads.
  2. Add or edit your Campaign Creative. Fill in the Landing Page as the URL and save.

Sample URL: https://www.example.com/mgid_landing_page

Use the Landing Page as the URL - not the link obtained from AppsFlyer.

Add a Click ID macro at the campaign level. 

  1. Add or edit the relevant campaign.
  2. Under Tracking Tags > Add custom tracking tag fill in: clickid={click_id}

Enter the portion on the right exactly as shown: {click_id}

For additional information about adding passback macros see: MGID Marcos Made Simple

Create links for your Landing Page CTAs. 

  1. Open the AppsFlyer dashboard. 
  2. Select the relevant App and navigate to Integrated Partners > MGID (see above: Enable the MGID Integrated Partner). 
  3. Under the Attribution Link tab, copy the Click Attribution Link created for MGID

Sample AppsFlyer Link: https://app.appsflyer.com/com.appsflyer.adNetworkTest?pid=mgid_int&af_click_lookback=7d&clickid={click_id

Do not edit the Click ID portion (in red) - it should look exactly as shown. 

The PID portion (in orange) tells AppsFlyer to attribute the conversion to MGID.

4. To prepare the link for your Landing Page, remove the entire query string (show below in

red):

Original, sample link:

https://app.appsflyer.com/com.appsflyer.adNetworkTest?pid=mgid_int&af_click_lookback=7d&clickid={click_id

Edited, sample link:

https://app.appsflyer.com/com.appsflyer.adNetworkTest

(Your Landing Page will re-apply the query string dynamically, as explained below.)

5. Add the following, custom functionality to your Landing Page:

  5.1. When a user arrives at your Landing Page, check for the Click ID in the URL. This

will signal that the user arrived via an MGID campaign.

For example:

https://www.example.com/mgid_landing_page?clickid=1281110

In the above example:

  • The name of the Click ID param is clickid (set up in MGID Ads - see the previous section).
  • The value of the Click ID is 1281110

Your Landing Page will need to persist the Click ID value for the duration of the user session - as explained below.

  5.2.  When the user clicks on a CTA, the Landing Page must append all relevant query

string params (below, in purple), and fill in the actual Click ID value received (in blue).

Example:

Link for all CTAs:

https://app.appsflyer.com/com.appsflyer.adNetworkTes

Click ID value received:1281110

When the user clicks on a CTA, the Landing Page must send him to:

https://app.appsflyer.com/com.appsflyer.adNetworkTest?pid=mgid_int&af_click_lookback=7d&clickid=1281110

The Click ID param should look exactly as shown above: clickid

How it works

Clicking on the above link redirects the user to the App Store/Play Store.

At the same time, AppsFlyer stores the Click ID. In the event of a conversion, AppsFlyer passes the event details and Click ID back to MGID.

An example:

 The following PHP code snippet illustrates the general idea:

  • The actual steps used to construct the CTA link is up to you, so long as you direct the user to the correct URL.
  • You can use any implementation of your choice to persist the Click ID - e.g. server-side scripting, browser cookies, client-side storage, etc.

What is the MGID Click ID?

When a user clicks on your campaign creative, MGID’s {click_id} macro passes a unique identifier to the destination URL.

Creative link:

https://www.example.com/mgid_landing_page?clickid={click_id}

Upon clicking, the user is directed to:

https://www.example.com/mgid_landing_page?clickid=1281110 

The 1281110  identifier is a Click ID. It stores information about the click event - e.g. which campaign was clicked and which user, etc. When AppsFlyer passes back the Click ID, MGID  uses it for attribution and tracking.

A real Click ID is an alphanumeric, case-sensitive string of up to 51 characters, e.g.,

CjwKCAjwq-TmBRBdEiwAaO1en-gBKumUjPHqDJzLTK18g2fLeg51Xp_WfE9kmJS1VWTnN65LARhRoCsekQathvte

Set up the Campaign 

  1. Log into the MGID dashboard and click on the “Add campaign” button.

2. After the campaign was created go to the Tab Conversion sensors - MGID.

We can add one step, or several, depending on at which stage you need to receive the tracking data. 

We will use the action -  'Install of application' step as an example.


We need to do the following actions step by step:

1. Select Install APP on Conversion Category.

2. Select the Postback tab.

3. Fill in the name of the event 

IMPORTANT  - For the Appsflyer system for the Install event you MUST use “lead” as shown above (case-sensitive) [3].

4. Click on the 'Save' button.  

If you need to add post-install events in MGID Dashboard ( for example - “purchase”) - 

You have to add a new step, repeat the 1 and 2 steps mentioned above and fill in the event name in the field [3].

Event Name - Use the same name that you provided in AppsFlyer, exactly as it appears there. See: Create In-App Events in AppsFlyer (above).

Use the identical event name, as it appears in AppsFlyer. Event names are case-sensitive.

Appsflyer will generate a postback to MGID automatically after an event in the app was triggered. 

Edit the campaign creative.  

Link the Campaign Creative directly to your Landing Page:

  1. Log into MGID Ads.
  2. Add or edit your Campaign Creative. Fill in the Landing Page as the URL and save.

Sample URL: https://www.example.com/mgid_landing_page

Understanding the end-to-end flow

 The following steps illustrate the end-to-end flow: 

1. Jack clicks on your creative. MGID appends the actual Click ID value (1281110) and directs Jack to your Landing Page:

https://www.example.com/mgid_landing_page?clickid=1281110

2. The Landing Page records the Click ID value for Jack’s session (using any implementation of your choice - e.g. server-side scripting, browser cookies, client-side storage, etc.)

3. A bit later, Jack clicks on a CTA on the Landing Page:

https://app.appsflyer.com/com.appsflyer.adNetworkTest

4. The Landing Page appends the relevant query string params and Click ID, and directs Jack to the target URL:

https://app.appsflyer.com/com.appsflyer.adNetworkTest?pid=mgid_int&af_click_lookback=7d&clickid=1281110 

5. AppsFlyer stores Jack’s Click ID (1281110) and directs Jack to the App Store/Play Store.

6. A bit later, Jack installs the App - which you defined as a conversion in the AppsFlyer dashboard and MGID Ads.*

7. AppsFlyer invokes the MGID postback URL, inserting Jack’s Click ID, and the event name:

AppsFlyer Integration

http://a.mgid.com/postback?c=1281110&e=lead 

8. MGID Ads reflects the conversion in the relevant reports.

* A similar flow will apply for any in-app events that were defined.