Migrate Your Google Analytics to Google Tag Manager Seamlessly with ga2gtm

If you have custom Google Analytics tracking code on your website, migrating the tracking to Google Tag Manager could be tricky because:

  1. After you replace the Google Analytics base code with the Google Tag Manager code, the custom tracking code on the web pages could cause Javascript errors because either _gaq or ga is undefined.
  2. You lose the tracking features provided by those custom tracking code.

So, one of the tasks in the migration work is to find out all the custom Google Analytics code snippets and replace them with the Google Tag Manager dataLayer code standard. Well, if you have all the previous implementation documents, and your developers have the time to deal with the changes, that shouldn’t be a problem. But things are not always that ideal.

ga2gtm is a project I created to address this issue. Basically what it does is to trigger the dataLayer code from the existing Google Analytics code, so that you don’t have to find them and replace them. All you need to do is to remove the Google Analytics base code, put the Google Tag Manager code and the ga2gtm code in. ga2gtm will convert the existing virtual pageview tracking, event tracking, social sharing tracking and eCommerce tracking into dataLayer format. Then you can pick them up in Google Tag Manager and do whatever you need to do with it. Installation is super simple, just one line of code to reference the ga2gtm Javascript file.

ga2gtm is an open source project licensed under MIT agreement. You can get it from its github repository for free here: https://github.com/GlobizSolutions/ga2gtm

Here is the installation instructions: https://github.com/GlobizSolutions/ga2gtm/wiki/Installation

Share this Story

About chaoming.li

Technology entrepreneur, web analytics specialist, Internet enthusiasts. I also like movies, computer games, history and other interesting stuff. I was born in Guangzhou China and I live in Sydney Australia now.

Leave a Reply

Your email address will not be published. Required fields are marked *


© Copyright 2014, All Rights Reserved