4TH AUGUST 2015 / WEB ANALYTICS

Tip: Grabbing the visitor's first date from cookies using Google Tag Manager

With the new Universal Analytics cookies and everything being calculated server-side, it's more difficult to detect some attribution problems or verifying if they were already fixed. For example after fixing a self-referrals problem we can continue getting more of them in our reports if some users were previusly tagged in Google Analytics. One little trick we could use is to grab the cookie creation date from the "_ga" cookie, convert it to an understandable…

30TH JULY 2015 / WEB ANALYTICS

Track alert() pop ups automatically in Google Tag Manager

Did you ever faced a site that still used the old-fashined alert popups for example for showing a form validation messages? and you were wondering how to track that form alert popups without needing to change anything on the site (as it is likely going to be an old one). And yep,they still exist. Hopefully if we are already using Google Tag Manager (or we can tell the client to add some little piece of code to their pages) we could track…

28TH JULY 2015 / WEB ANALYTICS

Tips to track an ajax based website using GTM and Universal Analytics

I've been dealing with some Ajax based website tracking these past months (mostly AngularJS based ones), and I've learn a lot of stuff , mostly some important points about how Google Tag Manager does work. Usually tracking an Ajax based website is a PITA, since mostly we don't have page reloads as all the content is loaded asynchronously. So either you ask the developers to push you the content loaded info into the dataLayer or you play with the…

7TH JULY 2015 / WEB ANALYTICS

Pushing custom commands to Universal Analytics before Pageview tag execution

Since I wrote the post about how to send a local copy of Universal Analytics hits I've been looking for a way to get this working within Google Tag Manager. But there's no way to send anything between the tracker creating and the hit firing on GTM. Some time ago there was a discussion thread on Twitter commenting this problem: @calebwhitmore @SimoAhava @DanielJTruman @peter_oneill cHTML is small price to pay for avoiding polluting data with…

28TH JUNE 2015 / WEB ANALYTICS

JWPlayer video tracking using Google Tag Manager

JWPlayer is one the most known video players (if not the most one) and today we're going to learn how to track it using GTM (Google Tag Manager). This time we're going to use an agnostic dataLayer pushes instead of the ones that we usually use for Google Analytics.  We'll be using one tag, one trigger and one variable, and in the next list we're resuming all the events that our code will be able to track: Video PlaysVideo PausesVideo CompletionsVideo…

3RD JUNE 2015 / WEB ANALYTICS

Yet another way/try to stop referrals/events spam on Google Analytics

The spam referrals problem in Google Analytics is turning into the new "not provided". Almost everyone I follow has posted/retweeted/said something about it in the past month. I didn't want to miss this oportunity to bring back some of the scripts I did in the past year for myself and share it with everyone. So in this post I'm going to try to address the Spam problem from another perspective that is not based on using referrals lists…

20TH MAY 2015 / WEB ANALYTICS

Handy dataLayer debugging tool for Chrome

One of those posts that were laying around on my drafts and that I've decided to publish. I know there're out there some good and well stablished tools that helps you to debug your Google Tag Manager implementation like the dataSlayer extension. But in the previous months I've been using a little JavaScript snippet that allows me to view in easy way the pushes that are being sent to Google Analytics in real-time in a nice way: This is how the debugging…

2ND MARCH 2015 / WEB ANALYTICS

How to track an intranet or an hybrid app

As we all know (do we?) Google Analytics uses cookies in order to work. This is, if for some reason the cookie can't be set it won't give any error but hits won't be fired at all. A cookie is usually set for a FQHN (Fully Qualified Host Name). So if for example we're going to track our intranet and we access it using an URL like : http://intranet/ Google Analytics is likely not going to work (it will depend on the browser that is accessing the page.…

18TH FEBRUARY 2015 / WEB ANALYTICS

Learn how does Universal Analytics Cross Domain work

Univeral Analytics tracking is based on cookies and on a randomly generated clientId. Yep, that's it. Each time you visit a site using Google Analytics for the first time a new cookie is set in your browser with a randomly generated hash (clientId), that will be used by Google Analytics servers to identificate you in the subsecuent visits.Let's see how the cookie looks:Any of those values can be modified using the JavaS

11TH FEBRUARY 2015 / WEB ANALYTICS

How does the Universal Analytics snippet work

(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-123123123', 'auto'); ga('send', 'pageview'); The first thing that may attract your attention is the function parameters,…