SlideShare a Scribd company logo
TRACK WHAT MATTERS MOST
Chad Haefele
Head of User Experience and Assessment
UNC Chapel Hill Libraries
cHaefele@email.unc.edu
Improving Analytics with Google Tag Manager
What is GTM?
• TAG: any bit of code (usually
javascript) you need to insert
into your site.
• Google Analytics basic code:
• Google Analytics Event Tracking:
<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.inse
rtBefore(a,m) })(window,document,'script','https://www.google-
analytics.com/analytics.js','ga'); ga('create', 'UA-41010981-7', 'auto');
ga('send', 'pageview');</script>
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue],
[fieldsObject]);
The problem with Google Analytics
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
How does GTM fix this?
<!-- 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-
KS5HJD8');</script><!-- End Google Tag Manager -->
<!-- Google Tag Manager (noscript) --><noscript><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-
KS5HJD8"height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript><!-- End Google
Tag Manager (noscript) -->
Inside your <head> tag:
Inside your <body> tag:
The only code you ever need to add to your site:
Setting up GTM
• tagmanager.google.com
Account Name: The name of your library
Setting up GTM
• tagmanager.google.com
Container Name: The URL of your library’s website
Where to use Container: Web
Setting up GTM
• tagmanager.google.com
Setting Up A GTM Account
• If you’re using WordPress, there are plugins to do this part for you.
I like the MetroNet Tag Manager:
http://wordpress.org/extend/plugins/metronet-tag-manager/
• If you previously used Google Analytics, make sure to remove
that code from your site!
Enabling Built-In Variables
• On the left menu, click Variables
• Click the Configure button
• Under the Clicks section, check the boxes for “Click URL”
and “Click Text”
Terminology
•Tag:
A little bit of code that runs on a page, like event tracking:
•Trigger:
A condition which, when true, will add a tag to your page.
ga('send', 'event', [eventCategory], [eventAction], [eventLabel],
[eventValue], [fieldsObject]);
Deploying Google Analytics with GTM
• In Tags, click on New
• Give your tag a name like Universal Analytics
• Click “Tag Configuration”
• Choose Universal Analytics
• Enter your Google Analytics Tracking ID
• Set the Track Type to “Page View”
• Click “Triggering”
• Select “All Pages”
• Click “Save”
• Click “Publish”
• Check the Real-Time section of Google Analytics to make
sure data is being reported as you browse your site.
Implementing Universal Link Tracking
• In Triggers, click New
• Give your trigger name, like Any Link Clicked
• Click on Trigger Configuration
• In the “Click” section, pick “Just Links”, then Save
• In Tags, click New.
• Give it a name like Universal Link Tracking
• Click on Tag Configuration, then Universal Analytics
• Insert Tracking ID
• Set the Track Type to Event
• Category: Universal Link Tracking
• Action: Link Clicked
• Label: Click the + icon and pick the Click URL variable
• Click the Triggering section at the bottom of the page.
• Select your Any Link Clicked trigger that we made
• Click Save
• Publish it
• Check Real-Time info in GA to see if it’s working
Tracking Your E-Resource Usage
• In Triggers, click New
• Give your trigger a name, like E-Resource Click
• Click Trigger Configuration
• In the “Click” section, pick “Just Links”
• Pick “Some Link Clicks”
• Set the boxes to “Click URL”, “contains”, and a unique string that’s part of all your e-
resource URLs (for me it’s go.php?c=)
• click Save
• In Tags, click New
• Give it a name like E-Resource Link Tracking
• Click on Tag Configuration, then Universal Analytics
• Insert Tracking ID
• Set the Track Type to Event
• Category: E-Resource Link Clicks
• Action: Link Clicked
• Label: Click the + icon and pick the Click Text variable
• Click the Triggering section at the bottom of the page.
• Select the E-Resource Click trigger we made
• Click Save
• Publish it
• Check Real-Time info in GA to see if it’s working
Tracking Your PDF Downloads
• In Triggers, click New
• Give your trigger a name, like PDF Click
• Click Trigger Configuration
• In the “Click” section, pick “Just Links”
• Pick “Some Link Clicks”
• Set the boxes to “Click URL”, “contains”, .pdf
• click Save
• In Tags, click New
• Give it a name like PDF click Tracking
• Click on Tag Configuration, then Universal Analytics
• Insert Tracking ID
• Set the Track Type to Event
• Category: PDF Downloads
• Action: Link Clicked
• Label: Click the + icon and pick the Click URL variable
• Click the Triggering section at the bottom of the page.
• Select the PDF Click trigger we made
• Click Save
• Publish it
• Check Real-Time info in GA to see if it’s working
Troubleshooting GTM
• In the upper-right
corner, click the down
arrow next to Publish.
• Click Preview
• Load your webpage in
another tab
Troubleshooting GTM
• As you browse your site, you’ll see (sometimes very
briefly) which triggers and tags are fired at the bottom.
Troubleshooting GTM
• When you’re done troubleshooting, go back to your GTM
tag and click Leave Preview Mode
Other Resources
• ALA’s Library Technology Report on Google Analytics and
Google Tag Manager, by Tabatha Farney
• https://journals.ala.org/index.php/ltr/issue/view/613
• Google Tag Manager Fundamentals course:
• https://analyticsacademy.withgoogle.com/course/5
• Uses an old version of the GTM interface
• Lynda.com’s GTM course
• https://www.lynda.com/Google-Tag-Manager-tutorials/Google-Tag-
Manager-V2-Essential-Training/168238-2.html
• Uses an old version of the GTM interface
• Google Tag Manager support
• https://support.google.com/tagmanager/
• Autotrack.js for an alternate method of setting up tracking:
• https://github.com/googleanalytics/autotrack/blob/master/README.
md
TRACK WHAT MATTERS MOST
Chad Haefele
Head of User Experience and Assessment
UNC Chapel Hill Libraries
cHaefele@email.unc.edu
Improving Analytics with Google Tag Manager

More Related Content

PPTX
Webmaster tool by Neha Nayak
PDF
Google Tag Manager for actionable metrics - Beyond basic Google Analytics
PPTX
Google analytics by Neha Nayak
PPTX
Google Analytics 101 Webinar
PDF
Digital Analytics with the Google Tag Manager (GTM)
PDF
Google Tag Manager
PDF
Google Tag Manager (GTM)
PPTX
Google Tag Manager for beginners
Webmaster tool by Neha Nayak
Google Tag Manager for actionable metrics - Beyond basic Google Analytics
Google analytics by Neha Nayak
Google Analytics 101 Webinar
Digital Analytics with the Google Tag Manager (GTM)
Google Tag Manager
Google Tag Manager (GTM)
Google Tag Manager for beginners

Viewers also liked (18)

PPTX
UA and Google Tag Manager – Why & How!
PDF
Google Tag Manager (Manual in English)
PDF
Google Tag Manager in 28 Minutes
PPTX
Google tag manager fundamentals question and answer (june 23 and july 24, 2015)
PPTX
Using Google Tag Manager to Improve Your Conversion Rate
PDF
Google Analytics (GA) & Google Tag Manager(GTM) 101
PPTX
Google Tag Manager Advanced - SEOCampixx 2016
PDF
Google Tag Manager - Revolve Conference 2015
PPTX
Universal Analytics and Google Tag Manager - Superweek 2014
PDF
Google Tag Manager - Basic Introduction
PPTX
Advanced Form Tracking in Google Tag Manager
PPTX
Google tag manager-web analytics101
PPTX
How Digital Marketer Uses Google Tag Manager To Improve Sales & Leads
PPTX
Google Tag Manager For Nerds
PPTX
Google tag manager
PDF
Tricks and tweaks for Google Analytics and Google Tag Manager
PDF
Masterclass Analytics Deep Dive met Google Analytics Advanced en Google Tag M...
PDF
Search Marketer's Toolkit for Google Tag Manager and Google Analytics
UA and Google Tag Manager – Why & How!
Google Tag Manager (Manual in English)
Google Tag Manager in 28 Minutes
Google tag manager fundamentals question and answer (june 23 and july 24, 2015)
Using Google Tag Manager to Improve Your Conversion Rate
Google Analytics (GA) & Google Tag Manager(GTM) 101
Google Tag Manager Advanced - SEOCampixx 2016
Google Tag Manager - Revolve Conference 2015
Universal Analytics and Google Tag Manager - Superweek 2014
Google Tag Manager - Basic Introduction
Advanced Form Tracking in Google Tag Manager
Google tag manager-web analytics101
How Digital Marketer Uses Google Tag Manager To Improve Sales & Leads
Google Tag Manager For Nerds
Google tag manager
Tricks and tweaks for Google Analytics and Google Tag Manager
Masterclass Analytics Deep Dive met Google Analytics Advanced en Google Tag M...
Search Marketer's Toolkit for Google Tag Manager and Google Analytics
Ad

Similar to Improving Analytics with Google Tag Manager (20)

PDF
Google Tag Manager for actionable metrics - Beyond basic Google Analytics
PPTX
Having fun with Google Tag Manager (implement cool things like weather tracki...
PPTX
Google analytics basic set up - gbg workshop 23 jan 2013
PPTX
Google Tag Manager
PDF
Track Report & Optimize Your Web Creations
PPTX
Google Analytics for SEO Beginners
PPT
Crash Course on Google Analytics
PDF
Google Analytics for Developers
PPTX
Advanced Google Analytics
PDF
Career Website Analytics - Webinar by J Walter Thompson INSIDE
PDF
Google Analytics for Developers
PDF
Data Driven Website Optimization - Big Footprint Tech4Good Presentation
PPTX
Google Optimize for testing and personalization
PPT
Using google analytics to optimize search engine marketing
PPTX
How to implement faq schema using tag manager
PPTX
google search console ppt. presentation.pptx
PPT
Google Analytics Report Automation (Magic Script)
PPT
Google Analytics Report Automation (Magic Script)
PPT
Google Analytics Report Automation (Magic)
PPTX
Google Tag Manager Training
Google Tag Manager for actionable metrics - Beyond basic Google Analytics
Having fun with Google Tag Manager (implement cool things like weather tracki...
Google analytics basic set up - gbg workshop 23 jan 2013
Google Tag Manager
Track Report & Optimize Your Web Creations
Google Analytics for SEO Beginners
Crash Course on Google Analytics
Google Analytics for Developers
Advanced Google Analytics
Career Website Analytics - Webinar by J Walter Thompson INSIDE
Google Analytics for Developers
Data Driven Website Optimization - Big Footprint Tech4Good Presentation
Google Optimize for testing and personalization
Using google analytics to optimize search engine marketing
How to implement faq schema using tag manager
google search console ppt. presentation.pptx
Google Analytics Report Automation (Magic Script)
Google Analytics Report Automation (Magic Script)
Google Analytics Report Automation (Magic)
Google Tag Manager Training
Ad

More from chaefele (15)

PPTX
Building a Library Website in WordPress (2019)
PPTX
Writing Accessibly Online
PPTX
Working with Shortcodes in WordPress
PPTX
Working With Media in WordPress
PPTX
Building an Academic Library Website in WordPress
PPTX
Remote Website Testing: How to Assess Your Website for Little or No Cost
PPTX
Rock your library’s content with Wordpress
PDF
Moving Forward: Redesigning UNC's Library Website
PPTX
Semi-Automatic Chat: Using a Library of Common Responses to Speed Up Chat Ses...
PPTX
Goodbye Gutenberg? The real impact of emerging technologies on libraries, pu...
PPTX
Building an app-like experience (without the app)
PPTX
Library in your pocket
PPT
Low Effort, High Impact Mobile Web Development
PPT
Serious Games - ARGs
PPT
Args
Building a Library Website in WordPress (2019)
Writing Accessibly Online
Working with Shortcodes in WordPress
Working With Media in WordPress
Building an Academic Library Website in WordPress
Remote Website Testing: How to Assess Your Website for Little or No Cost
Rock your library’s content with Wordpress
Moving Forward: Redesigning UNC's Library Website
Semi-Automatic Chat: Using a Library of Common Responses to Speed Up Chat Ses...
Goodbye Gutenberg? The real impact of emerging technologies on libraries, pu...
Building an app-like experience (without the app)
Library in your pocket
Low Effort, High Impact Mobile Web Development
Serious Games - ARGs
Args

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Empathic Computing: Creating Shared Understanding
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Electronic commerce courselecture one. Pdf
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Understanding_Digital_Forensics_Presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Unlocking AI with Model Context Protocol (MCP)
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Spectroscopy.pptx food analysis technology
Network Security Unit 5.pdf for BCA BBA.
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.
Encapsulation_ Review paper, used for researhc scholars
20250228 LYD VKU AI Blended-Learning.pptx

Improving Analytics with Google Tag Manager

  • 1. TRACK WHAT MATTERS MOST Chad Haefele Head of User Experience and Assessment UNC Chapel Hill Libraries cHaefele@email.unc.edu Improving Analytics with Google Tag Manager
  • 2. What is GTM? • TAG: any bit of code (usually javascript) you need to insert into your site.
  • 3. • Google Analytics basic code: • Google Analytics Event Tracking: <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.inse rtBefore(a,m) })(window,document,'script','https://www.google- analytics.com/analytics.js','ga'); ga('create', 'UA-41010981-7', 'auto'); ga('send', 'pageview');</script> ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
  • 4. The problem with Google Analytics ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
  • 5. How does GTM fix this? <!-- 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- KS5HJD8');</script><!-- End Google Tag Manager --> <!-- Google Tag Manager (noscript) --><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM- KS5HJD8"height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><!-- End Google Tag Manager (noscript) --> Inside your <head> tag: Inside your <body> tag: The only code you ever need to add to your site:
  • 6. Setting up GTM • tagmanager.google.com Account Name: The name of your library
  • 7. Setting up GTM • tagmanager.google.com Container Name: The URL of your library’s website Where to use Container: Web
  • 8. Setting up GTM • tagmanager.google.com
  • 9. Setting Up A GTM Account • If you’re using WordPress, there are plugins to do this part for you. I like the MetroNet Tag Manager: http://wordpress.org/extend/plugins/metronet-tag-manager/ • If you previously used Google Analytics, make sure to remove that code from your site!
  • 10. Enabling Built-In Variables • On the left menu, click Variables • Click the Configure button • Under the Clicks section, check the boxes for “Click URL” and “Click Text”
  • 11. Terminology •Tag: A little bit of code that runs on a page, like event tracking: •Trigger: A condition which, when true, will add a tag to your page. ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
  • 12. Deploying Google Analytics with GTM • In Tags, click on New • Give your tag a name like Universal Analytics • Click “Tag Configuration” • Choose Universal Analytics • Enter your Google Analytics Tracking ID • Set the Track Type to “Page View” • Click “Triggering” • Select “All Pages” • Click “Save” • Click “Publish” • Check the Real-Time section of Google Analytics to make sure data is being reported as you browse your site.
  • 13. Implementing Universal Link Tracking • In Triggers, click New • Give your trigger name, like Any Link Clicked • Click on Trigger Configuration • In the “Click” section, pick “Just Links”, then Save • In Tags, click New. • Give it a name like Universal Link Tracking • Click on Tag Configuration, then Universal Analytics • Insert Tracking ID • Set the Track Type to Event • Category: Universal Link Tracking • Action: Link Clicked • Label: Click the + icon and pick the Click URL variable • Click the Triggering section at the bottom of the page. • Select your Any Link Clicked trigger that we made • Click Save • Publish it • Check Real-Time info in GA to see if it’s working
  • 14. Tracking Your E-Resource Usage • In Triggers, click New • Give your trigger a name, like E-Resource Click • Click Trigger Configuration • In the “Click” section, pick “Just Links” • Pick “Some Link Clicks” • Set the boxes to “Click URL”, “contains”, and a unique string that’s part of all your e- resource URLs (for me it’s go.php?c=) • click Save • In Tags, click New • Give it a name like E-Resource Link Tracking • Click on Tag Configuration, then Universal Analytics • Insert Tracking ID • Set the Track Type to Event • Category: E-Resource Link Clicks • Action: Link Clicked • Label: Click the + icon and pick the Click Text variable • Click the Triggering section at the bottom of the page. • Select the E-Resource Click trigger we made • Click Save • Publish it • Check Real-Time info in GA to see if it’s working
  • 15. Tracking Your PDF Downloads • In Triggers, click New • Give your trigger a name, like PDF Click • Click Trigger Configuration • In the “Click” section, pick “Just Links” • Pick “Some Link Clicks” • Set the boxes to “Click URL”, “contains”, .pdf • click Save • In Tags, click New • Give it a name like PDF click Tracking • Click on Tag Configuration, then Universal Analytics • Insert Tracking ID • Set the Track Type to Event • Category: PDF Downloads • Action: Link Clicked • Label: Click the + icon and pick the Click URL variable • Click the Triggering section at the bottom of the page. • Select the PDF Click trigger we made • Click Save • Publish it • Check Real-Time info in GA to see if it’s working
  • 16. Troubleshooting GTM • In the upper-right corner, click the down arrow next to Publish. • Click Preview • Load your webpage in another tab
  • 17. Troubleshooting GTM • As you browse your site, you’ll see (sometimes very briefly) which triggers and tags are fired at the bottom.
  • 18. Troubleshooting GTM • When you’re done troubleshooting, go back to your GTM tag and click Leave Preview Mode
  • 19. Other Resources • ALA’s Library Technology Report on Google Analytics and Google Tag Manager, by Tabatha Farney • https://journals.ala.org/index.php/ltr/issue/view/613 • Google Tag Manager Fundamentals course: • https://analyticsacademy.withgoogle.com/course/5 • Uses an old version of the GTM interface • Lynda.com’s GTM course • https://www.lynda.com/Google-Tag-Manager-tutorials/Google-Tag- Manager-V2-Essential-Training/168238-2.html • Uses an old version of the GTM interface • Google Tag Manager support • https://support.google.com/tagmanager/ • Autotrack.js for an alternate method of setting up tracking: • https://github.com/googleanalytics/autotrack/blob/master/README. md
  • 20. TRACK WHAT MATTERS MOST Chad Haefele Head of User Experience and Assessment UNC Chapel Hill Libraries cHaefele@email.unc.edu Improving Analytics with Google Tag Manager