Setting up Sales Funnel across websites in Google Analytics

In this article, you will learn to set up Sales funnel in Google Analytics, when some of the funnel pages (including the order confirmation page) are hosted on another website.

This is quite common in case of affiliate websites and third party shopping carts, where the final part of the checkout process occurs on a different website):

cross domain tracking set up

The Sales funnel in Google Analytics

Following is the sales funnel, we are going to set up in Google Analytics, by using virtual pageviews and by setting up cross domain tracking between our website and the website which host the shopping cart:

funnel1

funnel2

funnel3

This sales funnel is made up of following funnel pages:

#1 Product detail pages – a product detail page shows all of the information about a product. Let us assume, that all of these pages are hosted on your website.

#2 Shopping Cart page – this page list all of the products in a shopping cart. Let us assume that this page is also hosted on your website.

#3 Contact information page – this page asks for customers email and shipping address and provide an option to enter discount code. Let us assume that this funnel page is on the different website which host the shopping cart.

#4 Shipping page – this page allows a website user, to select a shipping method. This funnel page is on the website which host the shopping cart.

#5 Payment page – on this page the user enter his credit card details and provide billing address (if it is different from the shipping address). This page also provide an option to enter discount code. This funnel page is on the website which host the shopping cart.

#6 Place an order page – This is an order confirmation page which is shown to a user once he has complete a purchase. This funnel page is on the website which host the shopping cart.

All of these pages together, make up my sales funnel.

I am now going to set up this sales funnel in Google Analytics by following the steps below:

Step-1: Map your entire sales funnel.

Step-2: Set up cross domain tracking between your website and the website which host the shopping cart.

Step-3: Configure the website which host the shopping cart to generate and send virtual pageviews.

Step-4: Set up sales funnel in Google Analytics and test it.

Get the E-Book (37 Pages)

Learn to read e-commerce reports book banner

Get the E-Book (104 Pages)

#1 Map your entire sales funnel

Determine all of the web pages which make up your shopping cart. In my case, the sales funnel is made up of following pages:

#1 Product detail pages – https://www.mywebsite.com/collections/products/

#2 Shopping Cart page – https://www.mywebsite.com/cart

#3 Contact information page – https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93?step=contact_information

#4 Shipping page – https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93?step=shipping_method

#5 Payment page – https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93?step=payment_method

#6 Place an order page – https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93/thank_you

#2 Set up cross domain tracking

By default, Google Analytics does not share cookie information (client ID) with another website.

Because of this reason, by default, you can’t track website user’s journey which span multiple domains.

In order to track user’s journey across domains, follow the steps below:

Step-1Allow your website (i.e. source domain) to pass cookie information (client ID) to the website which host the shopping cart (i.e. destination domain).

In order to accomplish this goal, add following line of code in the Google Analytics Tracking Code of your website:

ga(‘create’, ‘UA-12343-26’, ‘auto’,{‘allowLinker’: true }); // allow source domain to pass cookie information

Now your Google Analytics tracking code, may look like the one below:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-12343-26', 'auto',{'allowLinker': true });
  ga('send', 'pageview');

</script>

Step-2: Set up AutoLink plugin for your website.

This plugin is used to track cross domain traffic in Google Analytics. Add following line of code in the Google Analytics Tracking Code of your website:

ga(‘require’, ‘linker’); // setup autoLink plugin

Now your Google Analytics tracking code, may look like the one below:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-12343-26', 'auto',{'allowLinker': true });
  ga('require', 'linker');
  ga('send', 'pageview');

</script>

Step-3: Define the domain that need to be automatically cross linked

You can define the domain that need to be automatically cross linked by using the linker:autoLink’ Command.

Let us suppose the address of the website which host your shopping cart is anotherWebsite.com.

So here is how the linker:autoLink command can be used in that case:

ga(‘linker:autoLink’, [‘anotherWebsite.com’]); // Auto link to anotherWebsite.com

Add this line of code to the Google Analytics tracking code of the website.

Now your Google Analytics tracking code, may look like the one below:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-12343-26', 'auto',{'allowLinker': true });
  ga('require', 'linker');
  ga('linker:autoLink', ['anotherWebsite.com']);
  ga('send', 'pageview');

</script>

Step-4: Allow the website which host the shopping cart (i.e. destination domain) to accept cookie information (client ID) from your website (i.e. source domain).

In order to accomplish this goal, add following line of code in the Google Analytics Tracking Code of the website which host your shopping cart:

ga(‘create’, ‘UA-196844-17’, ‘auto’,{‘allowLinker’: true }); // allow destination domain to accept cookie information

Now the Google Analytics tracking code of the destination domain, may look like the one below:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-196844-17', 'auto',{'allowLinker': true });
  ga('send', 'pageview');

</script>

Step-5: Set up AutoLink plugin for the destination website. Add following line of code in the Google Analytics Tracking Code of the destination domain:

ga(‘require’, ‘linker’); // setup autoLink plugin

Now the Google Analytics tracking code of the destination domain, may look like the one below:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-196844-17', 'auto',{'allowLinker': true });
  ga('require', 'linker');
  ga('send', 'pageview');

</script>

Step-6: Define the domain that need to be automatically cross linked – Let us suppose the address of your website is mywebsite.com. So here is how the linker:autoLink command can be used in that case:

ga(‘linker:autoLink’, [‘mywebsite.com’]); // Auto link to mywebsite.com

Add this line of code to the Google Analytics tracking code of the destination domain.

Now the Google Analytics tracking code of the destination domain, may look like the one below:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-196844-17', 'auto',{'allowLinker': true });
  ga('require', 'linker');
  ga('linker:autoLink', ['mywebsite.com']);
  ga('send', 'pageview');

</script>

As you can see, setting up cross domain tracking is not that hard. The problem really occurs, when you can’t change the Google Analytics tracking code of the destination domain, which host your shopping cart.

In that case, you can ask the developer/webmaster of the destination domain, to add following line of code (highlighted in bold) to his Google Analytics tracking code:

<script>
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);

ga(‘create’, ‘UA-196844-17’, ‘auto’,{‘allowLinker’: true });
ga(‘require’, ‘linker’);
ga(‘linker:autoLink’, [‘mywebsite.com’]);
ga(‘send’, ‘pageview’);

</script>

Note: replace mywebsite.com by your domain name.

Once this task is complete, the cross domain tracking is set up between your website and the website which host the shopping cart.

If the developer/webmaster of the destination domain, refuse to add the cross domain tracking code to his GA tracking code, then there is nothing much you can do, except change your shopping cart provider.

If you are using a popular shopping cart like Shopify, then you don’t need to ask them, to add the cross domain tracking code to their GA tracking code.

As soon as you enable the Google Analytics tracking in your shopify account, cross domain tracking will be automatically set up.

So when a user leave your website and move to the shopping cart (hosted by Shopify) to complete the checkout, the cross domain tracking is already there to track user’s activities between your website and the third party shopping cart.

To learn more about cross domain tracking, read the article: Cross Domain Tracking in Universal Analytics – demystified

#3 Configure destination domain to send virtual pageviews

You now need to configure the destination domain, so that it sends virtual pageviews for each funnel page.

For example, if a user visit the Contact information page (hosted on the destination domain), you can add the following code to the destination domain:

ga(‘send’, ‘pageview’, ‘/checkout/contact_information‘);

Here , ‘/checkout/contact_information’ is a virtual pageview which is generated and sent, whenever your website users, visited the ‘Contact information’ page hosted on the destination domain.

Configuring destination domain to send virtual pageviews, varies from domain to domain. The actual implementation depends upon the CMS and shopping cart being used by the destination domain.

So I can’t share a code, which you can use and configure your destination domain to send virtual pageviews.

If you are using a shopping cart like Shopify, you don’t need to configure the shopify website to send virtual pageviews to your GA property. You just need to identify the virtual pageviews, which Shopify generates for each funnel step.

To identify such virtual pageviews, follow the steps below:

Step-1: Navigate to the first funnel page, hosted on Shopify via Google chrome browser. In my case, the first funnel page hosted on Shopify, is the Contact information page (https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93?step=contact_information)

Step-2: Right click on the web page and select ‘Inspect‘. This will open the ‘Google Developer Console

Step-3: Click on the ‘console’ tab and then search for the virtual pageview generated by the page:

shopify virtual pageview

The virtual pageview generated by the ‘contact information’ page is ‘/checkout/contact_information

Step-4: Use step 1 to 3, to determine the virtual pageview generated by each funnel page hosted on the destination domain. In my case, following would be the various virtual pageviews:

#1 Virtual pageview generated by Contact information page (https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93?step=contact_information) – /checkout/contact_information

#2 Virtual pageview generated by Shipping page (https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93?step=shipping_method) – /checkout/shipping

#3 Virtual pageview generated by Payment page (https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93?step=payment_method) – /checkout/payment

#4 Virtual pageview generated by Place an order page (https://checkout.shopify.com/3108721/checkouts/d7ba5d79341cdb6755266b811ed15d93/thank_you) – /checkout/thank_you

#4 Set up Sales Funnel in Google Analytics

Once you have documented the virtual pageviews for each funnel page, you can now set up the sales funnel in Google Analytics.

Follow the steps below:

Step-1: Create a new goal of type destination in your GA view.

Step-2: Configure the funnel steps as shown below:

final funnel1

final funnel2

Step-3: Carry out 2 or 3 test transactions, on your website and then check your funnel visualization report after couple of hours. If you see data for each funnel step, then your sales funnel is working.

Note: You can not use events as funnel pages in Google Analytics.

Similarly, you can also use virtual pageviews and cross domain tracking, to set up Goal funnel which spans across websites.

Learn about the Google Analytics Usage Trends Tool

The Google Analytics usage trend is a new tool which is used to visualise trends in your Google Analytics data and to perform trend analysis.


Take your knowledge of Web Analytics to the next level. Checkout my web analytics training course.

Take your Analytics knowledge to the next level. Checkout my Best Selling Books on Amazon

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and Beyond
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Himanshu Sharma

Certified web analyst and founder of OptimizeSmart.com

My name is Himanshu Sharma and I help businesses find and fix their Google Analytics and conversion issues. If you have any questions or comments please contact me.

  • Over eleven years' experience in SEO, PPC and web analytics
  • Google Analytics certified
  • Google AdWords certified
  • Nominated for Digital Analytics Association Award for Excellence
  • Bachelors degree in Internet Science
  • Founder of OptimizeSmart.com and EventEducation.com

I am also the author of three books:

error: Alert: Content is protected !!