Mobile landing page attribution guide

  • Advertisers
  • Agencies
  • Developers

Introduction

Landing pages are a very common technique among digital marketers. They allow the marketers to capture their leads' details for remarketing, even if these users don’t convert at first.

However, for mobile user acquisition, the landing page strategy has upsides and downsides.

The upsides:

  1. Leads, who eventually get to install, should be more engaged with the app.
  2. The more complicated services (e.g. financial services) require more explanations to convert their leads, which is enabled by landing pages.

The downsides:

  1. The longer funnel reduces the final number of converted leads.
  2. It is more technically challenging to attribute.

The Challenges of Mobile attribution on Landing Pages

  1. Different media sources require different methods to complete the landing page scenario with the correct attribution data.
  2. Last click attribution model may cause loss of correct attribution, if the landing page has its own attribution links.
  3. Direct website visitors are recorded as organic, unless the landing page has its own attribution links.
  4. Desktop visitors are recorded as organic, unless the landing page has a method of recording their conversions into mobile users.

The Solution

To solve the mentioned landing page attribution problems, you need to implement a javascript flow in your landing page. We offer a sample script implementation that you can use. Make sure to adjust the script to fit your requirements.

In some cases, you also need to make some adjustments to your campaigns.

The scenarios below cover the requirements for all possible media source cases.

Landing Page Scenarios

Follow the implementation instructions below, for all the media sources sending leads to your landing pages.

Facebook: Cross-Platform Attribution

Description:

Facebook is an SRN, which doesn't use external attribution links.

Upon first app launch, AppsFlyer queries Facebook whether the user has previously (within the last 28 days) engaged with an ad for the app. If the user has engaged with a Facebook ad of the advertiser, Facebook self-attributes.

Facebook also attributes cross-platform, meaning that the user may interact with any type of campaign, mobile or not, on any platform, to be self-attributed by Facebook.

Conclusion:

A lead, coming from Facebook to a landing page, would lose the correct attribution to Facebook, if a new click is recorded on the landing page. Therefore, a landing page from Facebook should NOT contain attribution links.

Instructions:

  1. On your Facebook account create a “Link clicks” campaign with mobile attribution enabled, sending leads to your landing page
  2. Landing page Android download button - direct link to Google Play
  3. Landing page iOS download button - direct link to iTunes (OR attribution link without the device ID)

Google Ads: GCLID + Offline Conversion Upload

Description:

The usual process for install attribution of Google Ads campaigns requires clicking leads to be redirected to the app's store page URL.

So, when redirecting leads from Google Ads to a landing page, use a mediator to connect between the mobile install and the original click on the non-mobile Google Ads campaign.

Conclusion:

The solution for Google Ads has 2 parts.

The first part takes care of attributing on AppsFlyer the mobile users that get to the landing page from Google, and install the app from there. It requires tagging the click URLs from Google, identifying them on the landing page and creating a dynamic OneLink with data from the URL.

The second part takes care of notifying Google Ads about these mobile installs, using Google's offline conversion upload method.

 Note

This GCLID solution is not officially supported or recommended by Google.
In case that Google deprecates the GCLID parameter we will change the script to support the changes.
We recommend following this article, by clicking the Follow button in the article header, to get informed when there is an update to the article or attached script.

Instructions:

Part 1 - Attributing to Google Ads on AppsFlyer

On Google's dashboard - Enable Auto-tagging (here's how).
With auto-tagging enabled, the URL to the landing page contains the GCLID parameter.
URL example: http://www.yoursite.com/yourlandingpage?gclid={USER_GCLI D}

On your landing page load -

  1. Activate the attached function
  2. The Javascript function (see below) looks for the GCLID parameter and builds a long OneLink URL containing its value under the af_sub1 parameter (you can use any of the subscriber parameters af_sub1 - af_sub5).
  3. Landing page download button uses the generated OneLink URL.
    OneLink URL example: https://yourapp.onelink.me/abcd?pid=google_lp&c={CAMPAIGN_NAME}&af_sub1={USER_PARSED_GCLID}
  4. New mobile users are attributed to the google_lp media source and to the CAMPAIGN_NAME campaign (optional).
  5. No postback is sent to the media source
At this point, the installs are reported in AppsFlyer under the google_lp media source, with the GCLID, but not in Google Ads.
 
Part 2 - Uploading Installs to Google as Offline Conversions
This step is only required if you want the conversions to be recorded in the Google Ads platform.
For users attributed to google_lp, the AppsFlyer raw data now displays the GCLID value in the af_sub1 column. The GCLID is needed in order to upload offline conversions to Google Ads, you can find more information on the process here).
The conversions can be uploaded manually or via an Adwords API (more info on the API here).
You can export the CSVs with this information from your AppsFlyer account, or you can get this data from Push API in real-time for every install.

 Tip

You can also see the keywords your users searched for in AppsFlyer's raw data in a similar fashion to getting the GCLID:

  1. For keyword recording, you must include the keyword ValueTrack parameter in the final URL from Google Ads to the landing page
    URL example: http://www.yoursite.com/yourlandingpage?gclid={USER_GCLI D}&keyword={USER_KEYWORD}
  2. The Javascript function (see below) looks for the keyword parameter
  3. The value is added to the generated OneLink URL under af_keywords
    OneLink URL example: https://yourapp.onelink.me/abcd?pid=google_lp&c={CAMPAIGN_NAME}&af_sub1={USER_PARSED_GCLID}&af_keywords={USER_PARSED_KEYWORD}

The JS function below already contains the code to parse the keyword parameter as well.

Other SRNs: Add Parameter

Description:

Other SRNs, e.g., Snapchat or Twitter, are not cross-platform like Facebook, and require a bit of work to get your mobile users attributed to them.

Your campaigns with other SRNs lead your users to the landing page, and you are billed according to clicking leads, unrelated to any derived mobile users.

Conclusion:

When defining the landing page URL for a campaign on SRNs (besides Facebook and Google Ads), add a Partner ID parameter to the URL, which states the original SRN.
The landing page launches a javaScript (see below) that parses that parameter and builds a OneLink URL, which has the Partner ID value. When mobile users click on that OneLink and install, they get attributed to the stated media source.

Instructions:

On your SRN account -

  1. Create a non-mobile campaign
  2. When defining the landing page URL, add a Partner ID + landing page parameter to the URL (which is not an AF attribution link). The format is "&af_pid=srn_lp". (see example below)

On your landing page load -

  1. Activate the attached function
  2. The function looks for the af_pid parameter and builds a OneLink URL containing its value under the pid parameter
  3. Landing page download button uses the generated OneLink URL
  4. New mobile users are attributed to the custom "Partner ID + landing page" media source
  5. No postback is sent to the media source
If you specify the real SRN name, e.g. twitter_int, a postback might be sent to this SRN. This could result in double charges. See the note below for alternative names.
The script itself contains logic to prevent you from using these names. Look for var SRNs in the script. You should see a list of SRN names and a condition that checks if pidValue is any of these names. Remove this logic after you are done testing the script.

 Note

If you're sending users to your landing page, we recommend that include the following parameter on the URL of your landing page:

  • For Twitter: use "&af_pid=twitter_lp"
  • For Snapchat: use "&af_pid=snapchat_lp"
  • For Doubleclick: use "&af_pid=doubleclick_lp"
  • For Facebook Post (unpaid): use "&af_pid=fbpost_lp"
  • For Oath (formerly Yahoo Gemini): use "&af_pid=oath_lp"

Attribution links: Redirect with af_r

Description:

Attribution links are used for any media source, which is not an SRN. That includes thousands of integrated partners and any owned media you wish to attribute.

Luckily, the solution for landing page attribution when using AppsFlyer's attribution links is simple (and similar to the solution for Facebook).

Conclusion:

the attribution link redirects the lead to a landing page, and by that also takes care of the correct attribution (if a mobile install follows).

All that is left to do is NOT prevent the correct attribution with another last click.

Instructions:

  1. Create the attribution link for the media source
  2. Add the landing page parameter leading to your landing page to the attribution link
  3. Add &af_redirect=true to the landing page value under any redirection parameters (i.e.. af_r, af_ios_url, af_android_url and af_ios_fallback) in the attribution link.
    Example: https://yourapp.onelink.me/abcd?pid=email&c={CAMPAIGN_NAME}&af_r=http://www.yoursite.com/yourlandingpage?af_redirect=true
  4. Optional - add device ID (GAID / IDFA) to the attribution link to allow attribution by ID matching instead of fingerprinting
  5. Landing page Android download button - direct link to Google Play
  6. Landing page iOS download button - direct link to iTunes

     Note

    The script and HTML sample page provide the option to set one download button that serves both Android and iOS. Read the comments in the script to learn how to implement it.

Links with UTM Parameters: Dynamic OneLink

Description

You may have traffic sources, which redirect users to your landing page using links with UTM parameters.

Conclusion:

If the original URL is NOT an AppsFlyer attribution link, the script searches for the utm_source and utm_campaign parameters in the link. If they exist, the script prepares a OneLink URL, that has them as the media source name (pid) and campaign name (c), respectively.

Note that with AppsFlyer attribution links, which also contain UTM parameters, the AppsFlyer parameters are being used, rather than the UTM ones.

Instructions:

On the media source -

  1. Make sure the utm_source exists in the link.
  2. utm_campaign parameter is optional, but highly recommended.

On your landing page load -

  1. Activate the attached function
  2. The function looks for the utm_source and utm_campaign parameters and builds a OneLink URL containing their values
  3. Landing page download button uses the generated OneLink URL
  4. New mobile users are attributed to the value of utm_source as the media source
  5. No postback is sent to the media source.

Mobile Organic Visitors: OneLink with pid=website

Description

Mobile organic visitors are, by definition, direct mobile web leads from unknown sources. They rarely visit dedicated landing pages, but may be the vast majority of mobile installs coming from the advertiser's web site.

Conclusion:

If you have a significant amount of mobile organic traffic from your web site, it's highly recommended to record the attribution data of your own traffic.

Instructions:

To attribute mobile organic visitors, the web site should have download or install buttons, with a OneLink attribution link behind them. OneLink enables diagnosing the device type and redirecting the lead to the correct app store according to it.

To learn how to set and build OneLink URLs go here.

 Tip

Add "&pid=website" to your attribution link to attribute all these visitors to your website.
In each page of your website, which has a download/install button with an attribution Link, add "&c={PAGE NAME}". This can help you find the highest and lowest converting pages in your website.

Desktop visitors: Telephone/Email form

Description

All the options covered above assume the users use mobile devices when engaging with the campaign and the landing page.

But what about desktop users?

Desktop users may arrive at your landing page/website, and afterward "independently" visit the app store with their mobile devices, and install the mobile app. Without the preceding engagement with the mobile devices, it is impossible to attribute these users, and so, they are labeled as "Organic".

Conclusion:

A great solution to this attribution problem is using a text-to-download form on your landing page, only for desktop users. This is to be followed by sending the mobile device an SMS/Email with OneLink URL.

Instructions:

  1. Identify that a visitor is a desktop user
  2. When your user types in their phone number, text them a link to your app, with a OneLink short URL. You can also ask for their email address to email them app download messages.
  3. The usage of OneLink is crucial here, as the mobile device platform isn't known when sending the message to the users. OneLink's diagnosis and redirection functionalities take care of this for you.
  4. Add "&pid=desktop_website" to the OneLink URL to identify this source.
  5. Add "&c={PAGE NAME}" to help you find the highest and lowest converting pages in your website for desktop users.

Landing Page Javascript

Below you can find the code implementation of the javascript that performs the full scope of attributing media sources and campaigns in landing page scenarios. If you want to have additional data such as ad sets and ad ids, you should make the necessary adjustments in the script.

For your convenience, you can also download the attached landing page example.

Below the code you can find the instructions for adapting it to your landing page needs.

The Script

Consider the following before you implement the script:

  • The script is offered as an example only. It covers the common landing page to attribution flow. Adapt the script to fit your requirements.
  • The script looks for specific parameters in the landing page URL, like media source, campaign, keywords etc. If you want to add more parameters like site id and ad sets, you need to modify the script accordingly.
//Returns the value of a parameter existing in the page's URL or ' ' if not exists.
function getParameterFromURL(name, url) {
  if (!url) url = window.location.href;
  name = name.replace(/[\[\]]/g, '\\$&');
  var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
    results = regex.exec(url);
  if (!results) return null;
  if (!results[2]) return '';
  return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

function isMobileDevice() {
  return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1);
}

function getMobileOperatingSystem() {
  var userAgent = navigator.userAgent || navigator.vendor || window.opera;
  if (userAgent) {
    if (/android/i.test(userAgent)) {
      return "Android";
    }

    // iOS detection from: http://stackoverflow.com/a/9039885/177710
    if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
      return "iOS";
    }
  }
  return "unknown";
}

function isAFLink() {
  return getParameterFromURL('af_redirect');
}

function isFacebook() {
  if (document.referrer && document.referrer != "") {
    return document.referrer.toLowerCase().includes('facebook');
  } else {
    return false;
  }
}

// generateUrl returns the URL to use behind the iOS and Android "Download" buttons on a landing page, based on the source of the page visitor.
// By default these buttons should direct to the apps' pages on iTunes and Google Play.
// If these links should be kept with no change, generateUrl returns ' '.
// Otherwise, generateUrl returns the URL to be used under BOTH buttons (a single app download button could also be used in this case).
// Parameters: isDebug - if true, alerts are issued for each of the cases, otherwise not.  	 
function generateUrl(isDebug) {
  var oneLinkURL = 'https://yourapp.onelink.me/abcd';   // **** Replace with your own basic OneLink URL ****
  var webFormURL = 'https://yoursite.com/webform.html'; // **** Replace with your own web form URL for getting the user's email or SMS ****
  var finalURL = "";
  var partnerIDParam = '?pid=';

  var campaignValue;
  if (getParameterFromURL('af_c')) {
    campaignValue = getParameterFromURL('af_c');
  } else if (getParameterFromURL('utm_campaign')) {
    campaignValue = getParameterFromURL('utm_campaign');
  } else if (document.getElementsByTagName('title')[0]) {
    campaignValue = document.getElementsByTagName('title')[0].innerText;
  } else {
    campaignValue = 'unknown';
  }
  var campaignParam = '&c=';
  var gclidParam = '&af_sub1=';
  var gclidValue = getParameterFromURL('gclid');
  var kwParam = '&af_keywords=';
  var pidValue;
  var kwValue = getParameterFromURL('keyword');
		
  if (getParameterFromURL('af_pid')) {
    pidValue = getParameterFromURL('af_pid');
  } else if (getParameterFromURL('utm_source')) {
    pidValue = getParameterFromURL('utm_source');
  }
  
  // Prevent the use of real SRN names. Remove this part after you are done testing the script.
    var SRNs = [
    'twitter_int',
    'facebook_int',
    'snapchat_int',
    'doubleclick_int',
    'yahoogemini_int',
    'yahoojapan_int',
  ];

  if (SRNs.includes(pidValue)) {
  	alert("DO NOT USE NAMES OF SRNS IN af_pid or utm_source - use the names listed in Other SRNs: Add Parameter section in the landing page article\nhttps://support.appsflyer.com/hc/en-us/articles/360000677217#other-srns-add-parameter");
    return;
  }

  // Desktop user
  if (!isMobileDevice()) {
    return webFormURL;
  }

  // User was redirected using af_r parameter on an AppsFlyer attribution link
  if (isAFLink()) {
    if (isDebug) {
      alert("This user comes from AppsFlyer by redirection and is ready to be attributed. \nKeep direct app store links.");
    }
    return; // in this case, the original store links in the install buttons stay the same

    /*
    If you want one install button in the landing page that serves both iOS and Android, uncomment the code below
    The code identifies the operating system and returns the relevant direct link to Google Play or iTunes
 
    if (getMobileOperatingSystem() === 'Android') {
      return 'direct link to Google Play';
    } 
 
    if (getMobileOperatingSystem() === 'iOS') {
      return 'direct link to iTunes';
    }
    */
  }

  // Google Ads
  if (gclidValue) {
    partnerIDParam += 'google_lp';
    campaignParam += campaignValue;
    gclidParam += gclidValue
    if (!kwValue) {
      finalURL = oneLinkURL + partnerIDParam + campaignParam + gclidParam;
      if (isDebug) {
        alert("This user comes from Google AdWords\n " + finalURL);
      }
      return finalURL;

    } else { // Google Ads with KW
      kwParam += kwValue;
      finalURL = oneLinkURL + partnerIDParam + campaignParam + gclidParam + kwParam;
      if (isDebug) {
        alert("This user comes from Google AdWords - there is a keyword associated with the ad\n " + finalURL);
      }
      return finalURL;
    }

  } else if (isFacebook()) {
    if (isDebug) {
      alert("This user comes from a paid Facebook ad - don't do anything. \nKeep direct app store links.");
    }
    return ' ';

  // Other SRNs and custom networks  
  } else if (pidValue) {
      campaignParam += campaignValue;
      partnerIDParam += pidValue;
      finalURL = oneLinkURL + partnerIDParam + campaignParam;
      if (isDebug) {
        alert("This user comes the SRN or custom network " + pidValue + "\n" + finalURL);
      }
      return finalURL;
    
  } else { // organic mobile user
    campaignParam += campaignValue;
    partnerIDParam += 'website'; //**** Replace value if you wish organic users to be attributed to another media source than 'website' ****
    finalURL = oneLinkURL + partnerIDParam + campaignParam;
    if (isDebug) {
      alert("This user comes from an unknown mobile source.\n The user would be attributed to media source 'website' and to the campaign " + campaignParam + "\n" + finalURL);
    }
    return finalURL;
  }
}

HTML Sample for Landing Page

<html>
<head>
  <title>Landing Page</title>
</head>
<body>
  <h1>Landing Page</h1>
  <!-- By default, the install buttons should have direct links to the stores -->
  <div>
    <a id="andrd_link" href="https://play.google.com/store/apps/details?id=com.appsflyer.sampleapp"><img src="/images/andrd.png"alt=""></a>
  </div>
  <div>
    <a id="ios_link" href="https://itunes.apple.com/us/app/id3********"><img src="/images/ios.png" alt=""></a>
  </div>
  <!-- If you want one button to serve both Android and iOS, use the code below instead
  <a id="store_link" href=""><img src="download.png" alt=""></a>
  -->
  <script type="text/javascript" src="/landing-page-test.js"></script>
  <script type="text/javascript">
    window.onload = function () {
      var url = generateUrl(true);

      // onelink is generated
      if (url) {
        document.getElementById('andrd_link').setAttribute('href', url);
        document.getElementById('ios_link').setAttribute('href', url);
      }

      //otherwise, if onelink is not generated it means that the user is redirected
      // and the store links in the buttons stay the same

      /* for the one button solution for both Android and iOS, use the code below instead

      document.getElementById('store_link').setAttribute('href', url);

      */

    };
  </script>
</body>

</html>

 Tip

You can implement the javascript snippet using Google Tag Manager. Google Tag Manager makes it easier for you to control when and where the landing page javascript should be used.

Instructions

  1. Activate the generateUrl script on page load of any page in your web site, which visitors can land on directly, and that has Download button/s for your mobile app/s.

     Important!

    By default the Download buttons should direct to the apps pages on iTunes and Google Play. If these links are kept with no change (i.e. visitor from AF attribution link or Facebook), generateUrl returns ' '. Otherwise, it returns the URL to be used with BOTH Download buttons (a single Download button could also be used in this case to cover for both apps with OneLink).

  2. Replace the oneLinkURL parameter value with your own basic OneLink URL in the exact format as the placeholder https://yourapp.onelink.me/abcd.
    MANDATORY to attribute visitors from all SRNs (except Facebook paid ads) and for mobile organic visitors.
  3. Replace the webFormURL parameter value with your own web form link. The web form should be able to get the user's email or SMS, and send the user's mobile device a message with a OneLink URL for downloading the app.
    MANDATORY to attribute desktop visitors.
  4. Replace the partnerIDParam parameter value, if you wish mobile organic users to be attributed to another media source than 'website'.
  5. BY default, users are attributed to the web page they are at when clicking the Download button, unless another campaign name is specified in the landing page URL (&c={CAMPAIGN_NAME}). To change that replace the value of campaignParam parameter value.
    Optional for ALL scenarios, except Facebook paid ads.

Viewing the Results

dashboard_landing_page_results.png

As with any media source, you can view your landing page results on your app's dashboard, raw data or via AppsFlyer's APIs.

If your mobile marketing funnel always leads to your landing page, these media sources represent the following:

Source Description

organic

users that didn't go through the landing page, or didn't engage with it. Alternately, users that did engage but were not attributed for various reasons, e.g. passed the attribution look back window before launching the app.

website

organic mobile users visiting your landing page/website and installing afterwards
facebook ads users from paid Facebook ads
fbpost_lp users from viral non-paid Facebook posts

google_lp

users from Google ads
[SRN]_lp users from other SRNs, i.e. Twitter (twitter_lp), Snapchat (snapchat_lp), Doubleclick (doubleclick_lp) or Oath (oath_lp)
Integrated partner ID users coming from an integrated partner's ad, which uses AppsFlyer's attribution link. For example: inmobi_int, tapjoy_int

desktop

desktop users filling in the web form, and completing an install after clicking on the SMS or email sent to their mobile devices afterwards

Other sources

users coming from owned media sources, which use AppsFlyer's attribution links. For example: email, sms, blog_post etc

OneLink for Landing Page Solution

OneLink™ is a unique AppsFlyer attribution link, which is used for device detection and redirection, or for deep linking.

The landing page solution requires the advertiser to have a basic OneLink URL, which can detect the user's device type and redirect to the correct app store accordingly.

If you haven't implemented OneLink for your app:

  1. Configure OneLink template
  2. Create a OneLink URL based on the template
  3. In the script, replace 'https://yourapp.onelink.me/abcd' with your OneLink URL
Was this article helpful?
1 out of 1 found this helpful

Page Contents: