You are on page 1of 12

GA2GTM

An Open Source Project for Seamless


Migration from GA to dataLayer
Presenter
Chaoming Li
- Years of analytics implementation experience
- http://chaoming.li/
GA to GTM Migration Tasks
- Replace base code
- Replace custom code with dataLayer
- Setup tags in GTM
GA
GTM
Custom Code
Replace
or
with
ga('send', 'event', 'button', 'click', 'nav buttons', 4);
_gaq.push(['_trackEvent', 'button', 'click', 'nav buttons', 4]);
dataLayer.push({'event': 'event', 'eventCategory': 'button', 'eventAction': 'click', 'eventLabel': 'nav buttons',
'eventValue': '4'});
Pain Points
Replace all custom code
- No documentation
- No time
- No money
- Potential JS error
Thats your expression after talking to the IT team
GA2GTM
- Open source (MIT License)
- One line of code
- No changes to custom code
- Handles
- Virtual pageview tracking
- Event tracking
- Social sharing tracking
- eCommerce tracking
Installation
- Download from GitHub
- Place GA2GTM immediately after GTM code
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-8MVS"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->
<script src="/your-javascript-folder/ga2gtm.min.js"></script>
UA Tags in GTM
Make sure Global Function Name is set as
not ga
Demo
Test Site: http://chaoming.li/ga2gtm/
Test Container: https://www.google.
com/tagmanager/web/#management/TagMana
gement/a12329998c657494/
More
- dataLayer can be used by other TMS
- Watch the project on GitHub
- Log issues and suggestions on GitHub
- Support more custom code syntax
Project URLs
- Blog Post: http://bit.ly/1BhkBSe
- GitHub Project: http://bit.ly/1tb4qAP
- Installation Guide: http://bit.ly/1xn91Gx
Quetions?

You might also like