Skip to main content
Skip table of contents

Can we measure organic traffic sources (URLs) on mobile apps?

To better understand source detection on mobile apps, a key point must be taken into account: apps are individual and distinct programs. This means they cannot share information, even if they’re being used on the same device.

By contrast, web navigation is usually restricted to a single browser. Since only one program is used, it is easy to gather information on previous pages, such as the referrer URL.

Accessing an app is necessarily done via another app (Google app, social app, email client, etc.) or manually. As such, when the first screen is loaded, the SDK has no way of ascertaining where a visitor comes from—i.e., no way of ascertaining the source of the visit. In practice, this means an app open is typically attributed as Direct unless you explicitly provide attribution data.

That said, the SDK does enable you to push this information if you are able to gather it on your end.

Option 1: Send a referrer using previous_url (organic-style attribution)

If your application can retrieve the URL (or identifier) that opened the app (for example via deep links such as Universal Links on iOS or App Links on Android), you can pass it to the first event of the visit (typically the first page.display) using the previous_url property.

Example:

CODE
pa.sendEvent('page.display', {
  page: 'page name',
  previous_url: 'https://www.referrerSite.com'
});

Notes and limitations

  • This is not automatically available on mobile. Unlike a browser referrer, the “previous page” is not provided by the operating system in most app-to-app navigation scenarios.

  • SEO deep links generally do not include a referrer. For example, when a user taps a Google Search result that opens your app directly via a deep link, the app typically does not receive the “came from Google” information. Without your own mechanism to capture and forward the originating URL, Piano cannot reconstruct the SEO source and the visit will appear as Direct/Unknown.

  • If the user first lands on a tracked web page and that page redirects to the app, the web visit can be attributed (e.g., Search Engines), but the app open is a new context and will still be treated as a new visit in the app—often Direct—unless you pass previous_url or campaign parameters into the app.

Smarttag: For SmartTag users, you can use setParam, which will enable you to send the referrer alongside the hits (parameter key is ref).

Option 2: Use a campaign tracker for links you control (marketing attribution)

You can also use a campaign tracker. This will enable you to obtain the source for links you have control over, such as for ads, social media, push notifications, or email campaigns.

To classify a visit as marketing-driven, you must ensure campaign information is present in the first event of the visit. At a minimum, populate:

  • src_medium

  • src_campaign

Example:

CODE
pa.sendEvent(new Event("page.display", new HashMap<String, Object>() {{
  put("page", "Page name");
  put("src_medium", "email");
  put("src_campaign", "launching");
  put("src_creation", "promotion");
  put("src_myCustomProperty", "myCustomValue");
}}));

What this does not solve

Campaign tracking does not give you the source of visits from links you have no control over, such as a search engine results page (SERP), unless you have an intermediate mechanism that adds campaign parameters or otherwise captures the origin before opening the app.

App store attribution (download origin) considerations

If your use case is to identify where the app install came from (as opposed to where an in-app visit came from), be aware:

  • iOS App Store: Apple does not provide referrer information to the app for install origin. Use Apple’s own statistics for download attribution.

  • Google Play Store (Android): The Play Store supports an install referrer mechanism, which can be used to pass campaign/deeplink information and make it available at first launch. If you capture this value, you can then send it to Piano using src_* properties (marketing) or previous_url (referrer-style), depending on your attribution model.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.