Inject Google Analytics Client ID to All Your Links
We have been playing with Google Analytics Client ID and found that not many agencies have been using it.
The Client ID can be found in the GA cookie and Client ID is stored on the GA cookie of your website’s actual domain.
Google Analytics stores a unique identifier for every user who visits your site within a first-party cookie. This value, in GA parlance, is called the Client ID, and the name of the cookie is _ga.
Here’s what the entire cookie string looks like, with the actual Client ID bolded:
2139536866.1471456764
Client ID could be extremely useful if you are trying to track a multichannel behaviour:
User clicks on a Display ad, then clicks on an Affiliate link, then sees a Twitter ad, then searches through Google, then converts. You can capture all these separate interactions with Client ID.
Adding this simple JS code to your analytics will enable you to add client ID reference to all your urls.
ga(function(tracker) {
var clientId = tracker.get('clientId');
jQuery(document).ready(function($){
var href = $("a").attr('href') + "&id=" + clientId;
$("a").attr("href", href);
});
});
Once this code is installed, you will be able to filter pages by Client ID.
Feel free to change the code when necessary or get in touch for a code customisation.
Related reading…
WordPress is Hacked Again: Cashnude.com Exploit Hack Solved
Over the years, we have seen plenty of WordPress hacks and thankfully they are usually fairly easy to diagnose. This bank holiday Monday we have fought a nasty one from cashnude.com a spammy website which opens up an adult chat as a pop up, under...
read moreHow to Add Google Plus Authorship to a Shopify Site
Adding Google authorship to content is now an important step for many sites and content creators. Enabling your content to display its author gives your listings in the search engine results a potential increased CTR of over 20%. Including it on...
read moreHack on How to Track Shopify Sales in Google Analytics
Allowing users to purchase through PayPal skews sales data in Google analytics, all transactions are tracked as PayPal which isn’t ideal as we want to know which channel is performing better. However, there is a simple solution to overcome this...
read more