Cross Domain and Ecommerce Tracking with Google Analytics and Business Catalyst

Cross Domain & Ecommerce Tracking with Google Analytics and BC

by Scott B Reynolds, March 7th, 2014

Try using the Business Catalyst App, Google Analytics Manager, to accomplish cross domain and ecommerce tracking.

Business Catalyst has built-in analytics, but that doesn’t stop Business Catalyst Partners from using other tracking systems, like Google Analytics (GA). There are lots of advantages to using a 3rd-party system on a BC site.

  • The website being only one part of a larger tracking strategy
  • Goal Flow and Funnel Visualization
  • Split Testing (experiments)
  • Remarketing
  • Advertising campaign tracking
  • Ecommerce Tracking
  • Etc…

Google makes it easy to add tracking code to a website – simply copy and paste a code snippet into the html. If you have a simple website this will likely be good enough. Learn more about setting up basic Google Analytics.

If your site uses the ecommerce module or secure web forms you will quickly discover your GA reports are not showing you a complete review of action on your website. If you dig a little further you’ll notice GA is reporting your Business Catalyst site as two different sites, http://yoursitename.com and https://yoursitename.worldsecuresystems.com.

Google Sees Your Site As Two Sites

If a user lands on a non-secure page http:// and then makes a purchase on a secure checkout page https://, GA interprets this as the user leaving one site, going to another. Unless you tell Google that these pages should be considered as one site, this is how Google will track user movement through your Business Catalyst website.

Example of a user shopping through the ecommerce module on a Business Catalyst website

So, how do you tell Google?

The first step is to make sure you are using Google’s Universal Analytics. This is a new and upgraded version of Google Analytics. If you are starting a new account on Google Analytics you will automatically start with Google Universal Analytics. If you already have an account and you are using Classic Google Analytics you will need to upgrade.

Once you are sure you are using Universal Google Analytics, you will need to tell Google to track http and https versions of your site as one site. One easy way to do this is to use Google’s Cross Domain Auto Linking process. It’s a lot easier than it sounds. You simply use the code below - replacing two parts.

<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-XXXX-Y', 'auto', {'allowLinker': true});
    ga('require', 'linker');
    ga('linker:autoLink', ['worldsecuresystems.com', 'yoursitename.com'],false,true);
    ga('send', 'pageview');
</script>

Make the two simple changes below, and then paste the code snippet immediately before the closing </head> tag in all page templates you want to track.

  • On line 6 change 'UA-XXXX-Y' to your GA Tracking ID.
  • On line 8 change yoursitename.com to your url.

You're done. GA will now treat both sites as one by adding tracking parameters to all appropriate links (as needed). If you track referrals or ecommerce transactions, keep reading.

Ecommerce Transactions

If you have an ecommerce site and want to track transactions, paste the snippet below on the shopping cart's receipt layout: Site Manager > Module Templates > Online Shop Layouts > Receipt - Buy

<script>
	ga('require', 'ecommerce', 'ecommerce.js');
	var transactionAmount = '{tag_amount}';
	var cleanTransactionAmount = transactionAmount.split(',').join('');
	ga('ecommerce:addTransaction', {
		'id': '{tag_orderid}',
		'affiliation': '',
		'revenue': cleanTransactionAmount,
		'shipping': '',
		'tax': ''
	});
	ga('ecommerce:send');
</script>

Be sure to add this to the actual layout, not the template assigned to this layout. To view the transactions in Google Analytics navigate here: Conversions > Ecommerce > Transactions Google Analytics Conversions > Ecommerce > Transactions

Note: This system tracks the order ID and the total transaction amount. It does not track individual product amounts.

Referral Exclusions

To avoid self-referrals (in GA reports) add your site's urls to GA's referral exclusion list.

Now What?

Test. After you paste these code snippets, test to make sure it's working the way you expect. Fortunately Google's recent change to Universal Analytics has made it easier for BC Partners to track cross-domain visits and ecommerce transactions, but there's so much more you can do with the Universal Analytics. Learn more here.

[NOTE: A special thanks to Megan Bennett from Pixel Portal for inspiring this tutorial, and providing a beautiful supporting image.]

Scott B Reynolds

Scott B Reynolds

Scott is the founder of Thrise LLC, a Business Catalyst partner advisory board member, an Adobe Community Professional, a BC Sandpile manager, an Adobe Certified Expert, an Adobe User Group Manager, a Google AdWords Certified Partner, and a full-time astronaut. Scott has had his hands in HTML since the 90’s and often presents on topics related to design and marketing.