520 likes | 536 Views
Discover the power of Google Tag Manager, a service that simplifies script management for Google Analytics data collection and reporting. Learn to set it up, track events, and improve your website's data tracking process. Start enhancing your website analytics today!
E N D
Level up your Google Analytics with Google Tag Manager Tabatha Farney | University of Colorado Colorado Springs | tfarney@uccs.edu | @sharebrarian January 10, 2018
Google Tag Manager (GTM) is a web service that manages scripts.
All scripts are managed in the GTM interface (tagmanager.google.com)
You need both… + Collects website use data and sends it to Google Analytics. Holds and reports website use data.
x GA Tracking Code <script> (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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-1234567-1', 'auto'); ga('send', 'pageview'); </script>
Replace old GA code with GTM container <!-- Google Tag Manager --> <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= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer',' GTM-ZTQHBF8');</script> <!-- End Google Tag Manager --> <!-- Google Tag Manager (noscript) --> <noscript><iframesrc="https://www.googletagmanager.com/ns.html?id=GTM-ZTQHBF8" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> Head (<head>) section. Near the top of the body (<body>) section.
Why use GTM? • Easier to enhance the GA data collection process • Great test environment • No need to edit your website code • It can do more than just GA
Universal Analytics Pageviews Tag Tag’s Purpose: Syncs your Google Analytics tracking ID to every webpage on your website. To do this, you need: • 1 tag (Universal Analytics tag) • 1 trigger (All Pages trigger) • 1 variable (Google Analytics setting variable)
Testing Your Tags • Previewing your tags • Check Google Analytics’ Real-Time reports
Events What is it? event = user action Some examples: • Clicks on links • Form submissions • Video plays • File downloads • Pageviews longer than xx seconds • Clicks on anything!
Track Events Why do this? • Finally know what users are doing on your website • More accurate bounce rate How to do this? • Regular Google Analytics way • Google Tag Manager way
Regular Google Analytics Method Add the event tracking script to each event you want to track. _gaq.push([‘_trackEvent’, ‘Event Category’, ‘Event Action’, ‘Event Label’]);
<a href= “www.isiknowledge.com” onclick=“_gaq.push([ ‘_trackEvent’, ‘outbound link’, ‘click’, ‘social sciences citation index’]);”>Social Sciences Citation Index</a>
Outbound Link Event Tag Tag’s Purpose: Tracks all outbound links on a website. To do this, you need: • 1 tag (Universal Analytics tag) • 1 trigger (custom Click trigger) • 2 variables (Google Analytics setting variable and Click URL variable)
When you intentionally track website use data, you are more likely to actually use that data to drive decisions. “Entre nos,” by Andres Hoyos, flickr.com.
Develop an Analytics Strategy The steps: • Identify the purpose of the website. • Select the data points to measure the website’s purpose. • Is there anyone else that could use the data from the website?
What is the purpose of the library catalog? Find something
What information can determine if users found something in the library catalog?
Step 4. Configure Google Analytics to track that data. Events!
GTM Event Tracking Process • What action do you want to track? • How can GTM identify that action? The web developer tools in your web browser are essential in this process.
Hold Event Tag Tag’s Purpose: Tracks when a user clicks the hold button in the library catalog. To do this, you need: • 1 tag (Universal Analytics tag) • 1 trigger (custom Click trigger) • 2 variables (Google Analytics setting variable and Click URL variable)
Failed Search Event Tag Tag’s Purpose: Tracks when a user clicks the hold button in the library catalog. To do this, you need: • 2 tags (Custom HTML tag and Universal Analytics tag) • 2 triggers (custom event trigger and ) • 2 variables (DOM variable and Google Analytics setting variable)
No Search Results Variable This variable identifies the selector for GTM to look for.
GTM Data Layer Data Layer = a JavaScript array to store information and send that data to GTM. Good news everybody! You can store any data point you want in the data layer…. You just need to know HTML, DOM, and JavaScript.
Create a “Listening Tag” Select Custom HTML tag type. Add a script that pushes event info into the GTM data layer. Select All Pages trigger.
Create a No Results Trigger This Custom Event trigger will fire whenever the event called noResults is sent through the data layer.
Create the No Search Results Event Tag Select Universal Analytics tag type. Select Event as track type. Select No Results trigger.
Wait…you want to know what the user searched for? “Cat At Work Industry News Week Of 528 Animals,” foursaua.info, http://foursaua.info/cat-at-work/cat-at-work-industry-news-week-of-528-animals/
Google Analytics Custom Dimension A custom dimension is any custom data point you want to add to your Google Analytics data.
Configuring Custom Dimensions Why do this? • Track any data point on your website you want to analyze with website use data How to do this? • Create the custom dimension in Google Analytics Admin area • Create the user defined variable to capture the custom dimension • Add custom dimension information to your event tag
Create the Custom Dimension This creates a holding space for the data in Google Analytics. Remember that index number!
User-defined variable I used the URL user-defined variable that looks at the page url. In this example, this variable grabs and stores the query part of the url.
Add Custom Dimension info to tag Sync that user-defined variable to the custom dimension index number in the event tag.
All websites are different… …so track them differently.
Transitioning to GTM Run both Google Analytics and GTM at the same time BUT also: • Create a new test GA account and property (new UA-xxxxxx-xx) • Create a new GTM container and add to your website • Sync that new test GA property to the new GTM container
Additional Resources • Farney, Tabatha. 2018. Using Digital Analytics for Smart Assessment. ALA Editions, Chicago. • Farney, Tabatha. 2016. “Google Analytics and Google Tag Manager.” Library Technology Reports. https://journals.ala.org/index.php/ltr/issue/view/613 • Google Analytics Academy, https://analyticsacademy.withgoogle.com/ • Google Analytics Help Center, https://support.google.com/analytics/?hl=en#topic=3544906 • Google Analytics Blog, http://analytics.blogspot.com/