4

We have the following structure of our website:

Main site - mainsite.example

Contains blog, few products and pricing table etc...

Single product sites - myproduct1.example, myproduct2.example

Product specific website which sits on its own domain and contains pricing table

Storefront provider - Fastspring.com

Purchase is going through here for all sites and reports it to analytics.

Currently I have using the same Analytics property code for mainsite.example and fast spring.com with the following code on the main site.example:

<script type="text/javascript">

(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-33288836-1', 'yourwebsite.example'); 
ga('send', 'pageview'); 

// Load the plugin.
 ga('require', 'linker'); 

// Define which domains to autoLink. 
ga('linker:autoLink', ['fastspring.com']);

</script>

Currently the single product sites are not added into this Analytics workflow, but we would like to track that sites too.

We would like to see the following in Analytics at the end:

  • Stats on site basis (Fastspring.com aggregated into main site.example as currently)
  • If a visitor moves between our sites - mainsite.example, myproduct1.example, myproduct2.example - we would like to see proper referrers.
  • It is enough to see the purchase stats on the maindomain.example, but would like to see the original referrer, not myproduct1.example and myproduct2.example

Is it possible? What would be the proper implementation with Google Analytics?

  • Please check this out for your referral problem. Just exclude your domains in your analytic referral settings - it is like utm_overridenone=1. – Jurik Mar 7 '16 at 8:15
2
+50

Using a number of subdomains for individual product pages is not very scalable but if you want to track all the domains under one main property (and have the eCommerce data roll up into one view) there is a way to do this in Google Analytics. I will broadstroake it here but the detailed documentation can be found here.

Reorder your tracking code. ga('send', 'pageview'); has to be at the end of the GA script.

Add this code for all the external domains you want to link up. You already have most of it.

ga('create', 'UA-XXXXX-Y', 'auto', {'allowLinker': true}));
ga('require', 'linker');
ga('linker:autoLink', ['example-2.com', 'example-3.com'] );

ga('send', 'pageview');

Make sure the array ['example-1.com', 'example-3.com'] includes all the product pages you want to track.

Lastly, you have to add your main domain and all the external domains in the self-referral exclusion list. This can be found under the Admin section of GA -> Property -> JS Tracking Info -> Self-Referral Exclusion List

You will also have to add this code on all the other domains, modified appropriately:

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['example-1.com'] );

This will make sure the cookie you get from the main site will get shared accross the other domains. You will be able to test this by clearing your cookies and then navigating from your main site to the secondary domain and you should see ?_ga=1.34595........ appended to your URL in the address bar. You can also go to yourdomain.com?utm_source=cd_test&utm_medium=test and then look in the realtime view under traffic sources if you can see yourself.

  • Thanks I did what you suggested and works. Also I added the hostname into the request uri with an advanced filter and made views for each domain and filtering my data there. – Roland Soós Apr 8 '16 at 4:57
  • When adding a site's tracking code to other domains, make sure you don't have any hostname filtering set up (admin->view->filters). I had a filter in there to block hostname spam, which led to a few hours of wondering why my other domain wasn't tracking. – MikeTV Aug 4 '16 at 23:38
2

The way I interpret your question is you want to track users traveling through your product funnel to see them converting into sales and view domain specific data.

Most other answers are referring you to cross domain tracking using Google's Analytics.js library (requires custom coding and development), or purchasing premium (a license costs about $150k) which may work, although unless you're raking in huge amounts of revenue you can't get premium. And custom coding all your domains and data-layer parameters gets tedious.


My Answer

For our client websites and landing pages, users were changing domains in the middle in order to finalize a purchase. Which forced me to use cross-domain tracking (sending data from different domains to 1 analytics UA property).

The easiest way I found for cross-domain, goals, and event tracking was implementing Google's Tag Manager (GTM.js) which allows you to create different tags to fire and choose how they get triggered. This basically allows you to track almost anything on your page and send that data to your analytics property.

Now that everything is setup and we launch a new website, I just have to include 1 snippet of code from tag manager then just update or create a few tags and triggers in GTM control panel, depending on what data we want to see. In Analytics you can go and segment through all the data with different reports or views.

Here are a couple links to Google's documentation to get you started on GTM and Cross-domain:
https://developers.google.com/tag-manager/quickstart https://support.google.com/tagmanager/answer/6106951?hl=en

1

My understanding is: You want to track all your e-commerce info from multiple domains under one tracking code but would like to split stats down into different sites where possible and see referrals between them.

The easiest solution would be to get Analytics Premium. This can set your company back a lot, quotes tend to be in the $1,000s per year. This enables 'Account Rollup', as well as other features, which lets you aggregate data.

The non-premium solution is to split your domains into different tracking codes - then aggregate data from separate reports. You'll need to implement Cross Domain tracking using Tag Manager. This means every users action appears in all the Analytics properties for aggregating metrics. So you'll only need to view one profile to get full details for e-commerce. Then you set your view to only include those on a particular hostname (the current domain) when you want to filter out the extras. enter image description here

1

If I am understanding you correctly, the following may work.

First you need to create an "All Apps" property to get a UA number which will exist as the "pool" for multiple domains. Let's say that UA is UA-99999999-99.

Next we need a place to run the linker. We use a subdomain called "analytics.example.com" which is simply an index.html containing the following script. List domains you wanna pool up in this script (replace the UA and domain1.example, domain2.example, etc.):

<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-99999999-99', 'auto', {'allowLinker': true});
  ga('require', 'linker');
  ga('linker:autoLink', ['domain1.example, domain2.example, domain3.example'] );

  ga('send', 'pageview');

</script>

Then we can make properties for each domain which will generate separate UA's for them all. So in this case, lets call domain1.example UA-00000000-00. Instead of using the copypaste GA script, we need to roll a custom one using this UA, the "All Apps" UA, and the tracker subdomain. Replace all that with your desired values.

<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-00000000-00', 'auto');
  ga('send', 'pageview');

  ga('create', 'UA-99999999-99', 'auto', {'name': 'appTracker', 'allowLinker': true});
  ga('appTracker.require', 'linker');
  ga('appTracker.linker:autoLink', ['analytics.example.com'] );
  ga('appTracker.send', 'pageview');
</script>

Now you can add as many domain properties as you like, just point their linker to analytics.example.com and add their domain within the script found on that page. Depending on how your ecom analytics roll, you may have to add some more trackers to the "All apps" linker stack for each domain UA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.