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.

#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

Do you want expert help in setting up/fixing GA4 and GTM?

If you are not sure whether your GA4 property is setup correctly or you want expert help migrating to GA4 then contact us. We can fix your website tracking issues.

#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.

Other articles on cross-domain tracking

  1. How to see Organic Search Keywords in GA4 (Google Analytics 4)
  2. Google Analytics Ecommerce Tracking Tutorial
  3. Google Tag Manager Event Tracking Tutorial
  4. Google Analytics Event Tracking Tutorial
  5. Google Analytics Store Visits Tracking Tutorial
  6. Offline Conversion Tracking in Google Analytics – Tutorial
  7. Ecommerce Tracking Google Tag Manager (GTM) – Tutorial
  8. Tracking Virtual Pageviews in Google Tag Manager – Tutorial
  9. Google Tag Manager YouTube Video Tracking
  10. Google Analytics Virtual Pageviews Tutorial
  11. Google Analytics YouTube Integration & Analysis Tutorial
  12. Google Analytics for Facebook Tutorial
  13. Cross Domain Tracking in Google Analytics – Complete Guide
  14. How to use two Google Analytics codes on one page
  15. How to correctly use referral exclusion list in Google Analytics
  16. Google Analytics Calculated Metrics – Tutorial
  17. Creating your own Google Analytics Tag Auditing System
  18. Google Tag Manager Search Tracking without Query Parameter
  19. Tracking Google Analytics Paypal Referral and other payment gateways
  20. How to Track Phone Calls in Google Analytics 4 – Call Tracking Tutorial
  21. How to track leads in Google Analytics via CRM
  22. Postbacks in Google Analytics Explained
  23. Subscription & Recurring Revenue Analytics in Google Analytics
  24. Track the Impact of Google Analytics Cookie Consent on Website Traffic
  25. Tracking Offline Conversions in Google Ads
  26. Implementing Scroll Tracking via Google Tag Manager
  27. Scroll Depth Tracking in Google Tag Manager – Tutorial
  28. Site Search Tracking In Google Analytics Without Query Parameters
  29. Google Tag Manager Youtube Video Tracking via YouTube Video Trigger
  30. How to Correctly Measure Conversion Date & Time in Google Analytics
  31. Google Analytics Social Tracking – Twitter, Facebook, Google Plus and LinkedIn
  32. Cross Domain Tracking in Google Analytics – Complete Guide
  33. Google Analytics Linkedin & Twitter Tracking
  34. Creating Content Group in Google Analytics via tracking code using gtag.js
  35. Google Analytics Site Search Tracking via Query Parameters
  36. Google Analytics Site Search Tracking Tutorial
  37. Creating and Using Site Search Funnel in Google Analytics
  38. How to add Facebook Pixel to Google Tag Manager
  39. AMP Google Analytics Tracking – Learn to track AMP pages
  40. Setting up Sales Funnel across websites in Google Analytics
  41. Google Analytics 4 Regex (Regular Expressions) Tutorial

My best selling books on Digital Analytics and Conversion Optimization

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 BeyondSECOND EDITION OUT NOW!
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.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade