Have you been researching how best to set up Google Analytics for your SaaS or ecommerce site where you are using sub-domains?
Well, this post is simple. We will address these two very specific use cases.
Google Analytics Setup for SaaS and basic E-com sites with sub-domains!
In most cases, a business is using sub domains and not actually two separate domains. Hence, the goal is to make sure that users coming from sub-domain are not counted twice. That is the key challenge we want to solve in this post.
If a user starts a session on offer.ecomsite.com and then lands on ecomsite.com to complete the purchase, we want to make sure that user is viewed as a same user by Google Analytics and not as two different users.
Similarly, most SaaS have a setup where app.saas.com is where the users login and saas.com would be their marketing site.
In all the above use cases, we are using a sub domains, and not a new separate domain.
Now, after much research, here is what I found regarding sub domain tracking.
Yep, per Julian from Measure School,
"Technically, you don't need cross-domain tracking (for sub-domains), just make sure your auto cookie setting is true"
You need not do much of anything if you are using Google Tag Manger to fire off your Google Analytics.
If you are still using plain old JavaScript code directly from Google Analytics - STOP. It is time to get Google Tag Manager and make your life easier.
Using GTM, for sub-domain tracking you just need to make sure you have these things in order.
-
Inside GTM - Create a Google Analytics Variable
-
Inside GTM - Make sure the Google Analytics Variable has Cookie Domain setting ’ which is default.
-
Inside GTM - Configure Tag to fire on all pages.
-
In Google Analytics - add main domain to Referral Exclusion List (no sub-domains)
-
Test - Use Chrome Tag Assistant to check the GTM and Google Analytics codes are firing and use GA Debugger to see session is maintained across sub-domains.
If you have implemented the above steps in your Tag Manager and are firing off the GTM code on your main and all sub-domains, the Chrome Tag Assistant will look something like this.
Here is how to test if the userid stays the same across all your sub-domains and the main domain.
Click on
a) GA Debugger extension to turn it on
b) right click on the page and click on 'inspect'
c) Click on 'console' tab and search for 'cid'
d) Click on a link within your page that will take user to the 'sub domain' or main domain
e) Clik on 'inspect' on this page and search for 'cid'
The 'cid' should be the same on both your main domain and the sub-domain
Basically, we want to check if the user session is tracked as one user and not two if you hop from one sub-domain to another.
Yep. that is all you need to gather accurate data if your use case involves sub-domains!
Cross-domain Tracking!
Now, if the sub-domain use case does not apply to you and you have two unique domains and need to combine your Google Analytics into one account, here is the best video I found on Cross-domain Tracking with GTM by Julian from Measure School that will walk you through the setup.
ALAUDDIN AHMED WROTE this on Aug 10 There are 0 COMMENTS.
There are no comments
Post your thoughts