Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Imagine this. You’re running a promo campaign which brings traffic to a certain landing page (e.g. landingpage.com). After the visitor clicks the main Call-to-action button (e.g. GET YOUR DISCOUNT), he/she is redirected to another page (2ndpage.com) which asks a visitor to do the final action, install the app, fill in the form, sign up, etc.

When the conversion is completed, a Google Analytics event is fired. Unfortunately, when you look at your GA reports, what you’ll see is that all conversions are attributed to the landingpage.com. Technically, this is correct because all visitors landed on the 2ndpage.com from landingpage.com, but you’d like to see the original source which brought the visitor, wouldn’t you?

In this blog post, I’ll show you how to transfer UTM parameters from the initial page landingpage.com to the subsequent one (2ndpage.com) if the cross-domain tracking cannot be implemented.

The problem explained

Although this affects your conversion rate (in a bad way), sometimes it’s impossible to avoid the intermediate landing page.

Say, that you’re promoting an application which is available in the App Store. We’ll call it Lorem Appsum. Its App Store page isn’t sufficient to list all the benefits, cool features, etc. So you decided to create a separate landing page that you’ll drive traffic to. You have also marked all inbound links (stored on other websites/forums/etc.) that lead visitors to that landing page with UTM parameters.



Before we continue, here’s a quick update. Yehoshua Coren chimed in by saying that everything can be easily solved by implementing a regular cross-domain tracking. Yes, that’s totally true.

When I was writing this blog post, I actually, totally forgot to mention one more reason why cross-domain tracking isn’t always a solution. In case of app stores, sometimes creators/developers are not allowed to edit Google Analytics tracking code, therefore cross-domain tracking cannot be configured properly.

This is what we faced with Omnisend at Shopify Appstore. We were allowed to set Google Analytics Tracking ID, that’s it. Unfortunately, in order to make cross-domain tracking work, we also needed to enable allowLinker option on the receiving domain (app store) but that was not possible.

So we had to improvise and this blog post is the solution to the problem.



OK, let’s go back to the topic. You have a page in the app store, so you decide to create an additional intermediate landing page on a different domain. Cross-domain tracking cannot be implemented due to limited app store’s functionality.

That new landing page contains key selling points, descriptions of features, video, and a big GET APP NOW button (Call-to-action, a.k.a. CTA). Perfect. The visitor lands on the initial page, he clicks that CTA button, lands on the App Store page and installs the app. Heres’ the scheme of the entire visitor journey:

Visitor journey

Notice that UTM parameters are lost after the visitor clicks an appstore.com link on loremappsum.com page.

The problem is that Google Analytics will attribute this conversion to loremappsum.com, although it would be more beneficial to see the values of the initial UTMs.

 

The Solution – Overview

One of the solutions is to transfer UTM parameters from loremappsum.com and automatically add them to all links which redirect users to appstore.com/loremappsum. We’ll do this with Google Tag Manager and a custom script.

Once the visitor lands on loremappsum.com AND the Page URL contains utm_medium, utm_source, and utm_campaign, this script will be launched. It will scan the entire page and look for links which contain the domain of the final landing page, in this case, appstore.com.

If the script finds the link, it will:

  1. Fetch all 3 UTM parameters from browser’s address bar.
  2. And will add those UTM parameters to that spotted link (which contains “appstore.com”).

So instead of appstore.com/loremappsum, all links on loremappsum.com will be automatically modified to appstore.com/loremapsum?utm_medium=referral&utm_source=promo&utm_campain=blackfriday2017. Here’s the updated visitor flow:

Updated Visitor Journey

 

THE SOLUTION – Implementation in GTM

First of all, we need to create 3 URL variables which parse the value of 3 UTM parameters, utm_medium, utm_source, utm_campaign. They are important because we’ll use them in the custom script.

utm campaign source and medium

Important: In Google Tag Manager, you should name variables exactly the same as they are named in the script (case sensitive!), URL – utm_medium, URL – utm_source, URL – utm_campaign.

Next step, the trigger. We need to fire that custom script only when all 3 UTM variables contain something rather than undefined. In addition to that, we’ll need the DOM to be loaded in order to do some manipulations.

That’s why we’re creating a Pageview-type trigger with the following settings:

DOM Ready Trigger - URL contains UTMs

Finally, let’s create a Custom HTML tag with the script I’ve posted above.

Inherit UTMs - Custom HTML tag

 

Let’s Test

Save all changes, enable Preview and Debug mode. Now head over to the page you’re working on. There are two situations we need to test:

  1. Make sure that there are all 3 UTM parameters in the Page URL. In my case, the page URL is www.loremappsum.com?utm_medium=referral&utm_source=promo&utm_campaign=blackfriday2017
  2. Click the link which contains the domain name you have defined in that custom script I’ve shared in this blog post. In my case, it’s www.appstore.com/loremappsum
  3. After I’m redirected, the Page URL (appstore.com/loremappsum) should also contain those 3 UTM parameters. The final result in browser’s address bar should be www.appstore.com/loremappsum?utm_medium=referral&utm_source=promo&utm_campaign=blackfriday2017
    Appstore URL in browser address bar

Also, do not forget to test the opposite situation when there are not UTMs in the address bar. In that case, no UTMs should be appended to appstore.com links.

Oh, there’s also a third case to test, check at least a couple of other external links (unrelated to appstore.com), they should never contain UTM parameters.

Transfer UTM Parameters: Final words

In this quick blog post, I’ve explained how to transfer UTM parameters from one page to another. This is really useful when you have an intermediate landing page that you’re attracting visitors to, and then they have to proceed to the final page which is stored in another domain.

By default, you’ll lose all attribution data and Google Analytics will display your intermediate landing page as the main referral.

With the script I’ve shared, you’ll be able to reuse UTM parameters of the initial landing page and decorate certain links with them.

The situation I’ve described is not a very common issue, but it occurs from time to time. Actually, one of my readers has recently asked a question related to this very same topic.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Julius Fed

Head of Developer Operations at Omnisend. I am highly interested in Google Tag Manager, Google Analytics, Adwords, Email marketing, Email Deliverability, Digital Marketing in general. You can follow me on Twitter.