SlideShare a Scribd company logo
1 of 36
Fun with Google Tag
Manager
hannah@polkadotdata.com
charlotte@polkadotdata.com
Hannah Deakin and Charlotte Upfold
Polka Dot Data
Breaking
the ice
• Polka Dot Data – we’re the web
analytics specialists from Hampshire!
• Hannah – Senior Data Technologist
• Charlotte – Chief Number Whizz
• Participant introduction
• Name
• Role
• Experience level
• Something you want to learn
• What would your dream lunch be?
Just a few of
our clients
We’ve loved the variety!
Project Kick off Call
GA & GTM Audits & Updates
KPI Dashboard
KPI Scope & Mapping
What we do for EVERY client:
1 hr Handover Webinar
Documentation
Channel Guide
Expert Support Throughout
And most importantly, an amazing GA & GTM implementation!
Google Tag
Manager –
what, why and
how?
• A tag management system that’s part of the Google Marketing
Platform
• Google Analytics, DataStudio, Google Optimise, GTM
• Integrates really well with GA, AdWords
• Also Facebook, Bing, Floodlight – through built-in tags
• Can use Custom HTML tags to add in anything that hasn’t
yet been integrated
• In the old days…
• All your tracking code inline on the web page.
• Any updates, go through dev
• Now…
• GTM snippet placed inline on the web page
• Devs provide the information through a datalayer – a
collection of name-value pairs, information about what
the page is showing
• GTM tags can replace all other inline tracking code
• Decouples dependency between dev and marketing
How it all fits together
• GTM
Container
Snippet
• DataLayer
Website
• Tags
• Triggers
• Variables
GTM
Container
Data!
Google
Analytics
hannah@polkadotdata.com
charlotte@polkadotdata.com
GTM Concepts: Tags, Triggers and Variables
TAGS
TRIGGERS
VARIABLES
• Snippets of code, pre-built or custom
• Add customisations to work for you
• Rules and scenarios used against each tag
to tell it when to fire
• Specific details of information that can
either be exact, extracted from site, or
built to be dynamic.
• Referenced in Tags and Triggers
hannah@polkadotdata.com
charlotte@polkadotdata.com
Our Challenge Today
Add weather tracking to Google’s
Ecommerce demo site
• https://enhancedecommerce.appspot.com/
• An online T-Shirt shop
• Useful to try out GA enhanced ecommerce
yourself, and to see what the code should
look like
• We’re going to add some tracking of our
own to it
• Page views
• Links clicked
• Adding in location information
• Weather tracking
Trigger-
tastic fun
Getting
set up
Variables
& the
Datalayer
Tags at
your
service
Putting it
all
together
hannah@polkadotdata.com
charlotte@polkadotdata.com
What tools do we need today?
• Laptop + WiFi
http://bit.ly/gtm_workshop
• Chrome + extensions:
• Needed: Tag Manager Injector
• Nice to have: Google Analytics Debugger
Getting
set up
hannah@polkadotdata.com
charlotte@polkadotdata.com
Creating a new GTM container
• https://marketingplatform.google.com/about/tag-manager/
• Click “Start for Free”
• 1) Account Name: My DMSSO Test Container
• 2) Container name: enhancedecommerce.appspot.com
• 3) Accept t&Cs
• 4) Note down or copy your GTM container ID: GTM-xxxxx
Getting
set up
Your new GTM container!
• Other nice to haves: A test Google Analytics account
Getting
set up
hannah@polkadotdata.com
charlotte@polkadotdata.com
Let’s explore some tags
• Tags are just snippets of code (prebuilt or custom)
• Lots of tag types are already provided
• We use “Google Analytics – Universal Analytics” the most and Custom HTML
• What other ones catch your eye and are relevant to you?
• E.g. Google Ads Remarketing, Awin, Bing, Twitter, Adometry
• All the ones provided encapsulate all the code, so you know only need key information
• E.g. Account ID, revenue, product ids
Tags at
your
service
hannah@polkadotdata.com
charlotte@polkadotdata.com
Task 1: Create your first tag!
• Create new GA PageView tag
• Tag type: Google Analytics – Universal Analytics
• Track Type: Pageview
• Google Analytics settings: New Variable
• GA Tracking ID is: UA-123408449-2
• Add a trigger to it to tell it when to fire – “All Pages” to fire on every page
Tags at
your
service
GTM
preview
Task 1: Let’s test the tag works
In GTM, click Preview at the top right
In Chrome, go to https://enhancedecommerce.appspot.com/
It doesn’t have your GTM container on it at the moment. Let’s add it in!
In Chrome, open TagManagerInjector
GTM container id: GTM-XXX
Include Domain(s): enhancedecommerce.appspot.com
Click START
In Chrome, hit Ctrl-F5 to refresh the page
You should see the GTM preview pop-up in the bottom half of your screen
You should see your tag fire – like this:
Tag
Manager
Injector
Refresh!
Ctrl-F5
Big round of
cheers?
hannah@polkadotdata.com
Let’s explore triggers
Triggers are the rules that tell a tag when to fire
• Page View based: PageView, Dom Ready, Window Loaded
• Click based: All elements, links
• User engagement based: e.g. element visibility, form submission
• Others – e.g. custom events, javascript errors and timing
Can be customised to fire on certain conditions e.g.
• Page URL matches a particular RegEx
• Click Text equals some text
• Custom Javascript variable does not equal true
Trigger-
tastic fun
Task 2: Create a Trigger to fire when
Any Link is clicked
1) Create a click based trigger for all links
• Name: Click – All Links
• Trigger type: Click – Just Links
• This trigger fires on: All Link Clicks
Trigger-
tastic fun
Task 3: Create a tag that uses your
trigger
1) Create a Google Analytics tag called “GA Link Click Event”
Track Type = Event
Category = “<Your Name> - Link Click”
2) Assign the new “Click – All Links” trigger to your new GA Event tag
3) Save changes and Preview
Trigger-
tastic fun
How this looks in GTM preview
How this looks in GA
Trigger-
tastic fun
TIP!
Hold Ctrl while
you click to keep
it in the tab
Let’s explore GTM variables
• A GTM variable is a bit of information that can either:
• exact (a constant)
• dynamic
• extracted from site
• Within GTM, use double curly-braces to refer to variables:
{{variable-name}}
• A datalayer is just a collection of name-value pairs:
• in human-readable text format (JSON)
• GTM accesses a specific datalayer variable – see the GTM snippet
• Always push objects to the datalayer, to prevent overwriting
Variables
& the
Datalayer
Task 4: Add the link text to your GA
event action
• In task 3, we created a tag and trigger for a link click
• Add the Click Text of the link to the Event Action
Clues:
• GTM gives you a Built-In Variable to help
• Type in double curly braces {{ and GTM will offer you a list to choose from
Variables
& the
Datalayer
Task 5: Add location to your GA
event label
• Let’s add location to the datalayer of the web page
‘location’:’town-name’
• In Tag Manager Injector, add:
‘location’:’Southampton’
• In GTM, get the location datalayer value for your
‘GA Link Click Event’ label field
Clues:
• It will need a new variable in GTM, not built-in. What type?
Variables &
the
Datalayer
Here’s one we built earlier Variables &
the
Datalayer
How this looks in GTM preview
How this looks in GA
Variables &
the
Datalayer
Almost
there, let’s
put it all
together
hannah@polkadotdata.com
charlotte@polkadotdata.com
Rainy days and sunshine…
so I promised you weather tracking
https://openweathermap.org/api
• OpenWeatherMapAPI is a free API you can query to get the weather
• Free to register – gives you an ID
• Can run queries from within a browser
We will use our “DLV – location” variable to query the API and push
weather information into our datalayer!
Putting it
all
together
Task 6: Add weather to your
datalayer with a Custom HTML tag
1. New Custom HTML tag “Custom HTML – Weather Query”
2. Copy the code from (http://bit.ly/gtm_workshop) weatherTag.txt
3. Set it’s trigger to be your “Click – All Links” trigger
Putting it
all
together
<script>
(function() {
// You need to sign up to OpenWeatherMap for a free account. Once you do,
// you will find your APP ID in your account dashboard.
var owmAppId = '94d81e5044fc8c17aa4523dedc3c5ca4';
// location comes from the datalayer variable we built earlier
var location = {{DLV - location}};
// weatherQuery builds the query string to send to the API. You can try this in your browser
var weatherQuery = 'https://api.openweathermap.org/data/2.5/weather?q='+location+',uk&appid=' + owmAppId + '&units=metric';
var protocol = document.location.protocol === 'https' ? 'https' : 'http';
var fetchWeatherData = function() {
// This sends the request to the API and waits until the request is complete.
// Then it extracts some of the information to the datalayer.
jQuery.when(jQuery.getJSON(weatherQuery)).done(function(weatherData) {
window.dataLayer.push({
event: 'weatherDone',
weather: weatherData.weather[0].main,
weatherDescription: weatherData.weather[0].description,
temperature: weatherData.main.temp
});
}).fail(function(jq, status, message) {
console.log('Weather request failed: ' + status + '-' + message);
});
};
// Uncomment starred lines below if you want to only query weather every 30 minutes.
// Highly recommend this is done when using on a real site.
// Add a 1st party cookie variable called "session" and remove space from { {Cookie below
// * if (typeof { {Cookie - session alive}} == 'undefined') {
console.log('About to fetchWeather for '+ location);
fetchWeatherData();
// * }
// Reset "session" cookie with a 30-minute expiration
// * var d = new Date();
// * d.setTime(d.getTime()+1800000);
// * var expires = "expires="+d.toGMTString();
// * document.cookie = "session=1; "+expires+"; path=/";
})();
</script>
Sample code for weather tag
Please register with OpenWeatherMap API to get
your own ID if you want to use this for real!
How this looks in GTM preview
How this looks in GA
Putting it
all
together
Task 7: Create a new GA Weather Event tag and
trigger it from the weatherDone event
Trigger name: Custom - weatherDone
1. Trigger Type: Custom Event
2. Event Name: weatherDone
Tag name: GA Weather Event
1. Track Type: Event
2. Category: <Your name> - weather
3. Action: new variable for “weather”
4. Label: new variable for “temperature”
How this looks in GTM preview
How this looks in GA
Putting it
all
together
Bonus Fun for home: Send weather
as custom dimensions to GA
• Make sure you have the custom dimensions set up in GA admin
• Update your GA Settings variable – with custom dimension 1 set to
pull “weather” and custom dimension 2 set to pull “temperature”
• You’d probably also want a custom dimension for location
• This is harder to test in real-time, but will let you make some
awesome reports
Putting it
all
together
Finally…
1. You can publish your GTM container by
clicking Submit at the top right
2. STOP your Google Tag Manager Injector 
Set up
Variables
Tags
Weather
tracking
hannah@polkadotdata.com
charlotte@polkadotdata.com
Congratulations!
You got through all this:
Triggers
Insights
from your
website
Hannah Deakin
Charlotte Upfold
We’d love to get your feedback, what other courses
would you find useful?
If you’d like to get in touch please do – our website,
email, LinkedIn, Facebook
Analytics
Training
Set up &
Auditing
Get the
most from
your
website!
hannah@polkadotdata.com
charlotte@polkadotdata.com

More Related Content

Similar to Having fun with Google Tag Manager (implement cool things like weather tracking) by Hannah Deakin and Charlotte Upfold

Most Advanced GTM Deployment. Ever!
Most Advanced GTM Deployment. Ever!Most Advanced GTM Deployment. Ever!
Most Advanced GTM Deployment. Ever!Phil Pearce
 
All about google tag manager - Basics
All about google tag manager - Basics All about google tag manager - Basics
All about google tag manager - Basics Rob Levish
 
How Google Tag Manager changes everything you knew about website analytics
How Google Tag Manager changes everything you knew about website analyticsHow Google Tag Manager changes everything you knew about website analytics
How Google Tag Manager changes everything you knew about website analyticsMontgomery Webster
 
Crash Course on Google Analytics
Crash Course on Google AnalyticsCrash Course on Google Analytics
Crash Course on Google AnalyticsGrowth Hacking Asia
 
Google Tag Manager
Google Tag ManagerGoogle Tag Manager
Google Tag ManagerKim Towne
 
Google Tag Manager for actionable metrics - Beyond basic Google Analytics
Google Tag Manager for actionable metrics - Beyond basic Google AnalyticsGoogle Tag Manager for actionable metrics - Beyond basic Google Analytics
Google Tag Manager for actionable metrics - Beyond basic Google AnalyticsDesignHammer
 
Introduction to Google Tag Manager
Introduction to Google Tag ManagerIntroduction to Google Tag Manager
Introduction to Google Tag ManagerSteven Stadler
 
"Taster Slides" for Most advanced GTM implementation
"Taster Slides" for Most advanced GTM implementation"Taster Slides" for Most advanced GTM implementation
"Taster Slides" for Most advanced GTM implementationPhil Pearce
 
Google tag manager fundamentals question and answer (june 23 and july 24, 2015)
Google tag manager fundamentals question and answer (june 23 and july 24, 2015)Google tag manager fundamentals question and answer (june 23 and july 24, 2015)
Google tag manager fundamentals question and answer (june 23 and july 24, 2015)Mahendra Patel
 
Paul Duncan - Advanced Tracking & Enriched SERP Results via Google Tag Manager
Paul Duncan - Advanced Tracking & Enriched SERP Results via Google Tag ManagerPaul Duncan - Advanced Tracking & Enriched SERP Results via Google Tag Manager
Paul Duncan - Advanced Tracking & Enriched SERP Results via Google Tag ManagerJulia Grosman
 
Expert Tips and Techniques for Using Google Tag Manager
Expert Tips and Techniques  for Using Google Tag ManagerExpert Tips and Techniques  for Using Google Tag Manager
Expert Tips and Techniques for Using Google Tag ManagerOWOX BI
 
Lead Score Web Visitors For KILLER Remarketing, Upsell and Exit Intent Strate...
Lead Score Web Visitors For KILLER Remarketing, Upsell and Exit Intent Strate...Lead Score Web Visitors For KILLER Remarketing, Upsell and Exit Intent Strate...
Lead Score Web Visitors For KILLER Remarketing, Upsell and Exit Intent Strate...Hanapin Marketing
 
Marketo: hands on with Google Analytics
Marketo: hands on with Google AnalyticsMarketo: hands on with Google Analytics
Marketo: hands on with Google AnalyticsStijn Heijthuijsen
 
Google Tag Manager | Google Tag Manager Tutorial 2019 | Google Tag Manager Se...
Google Tag Manager | Google Tag Manager Tutorial 2019 | Google Tag Manager Se...Google Tag Manager | Google Tag Manager Tutorial 2019 | Google Tag Manager Se...
Google Tag Manager | Google Tag Manager Tutorial 2019 | Google Tag Manager Se...Simplilearn
 
Introduction about Google Tag manager
Introduction about Google Tag manager Introduction about Google Tag manager
Introduction about Google Tag manager Jam Hassan
 
Google Analytics - Webmaster Tools Pro Setup & Tips
Google Analytics -  Webmaster Tools Pro Setup & TipsGoogle Analytics -  Webmaster Tools Pro Setup & Tips
Google Analytics - Webmaster Tools Pro Setup & TipsRank Fuse Digital Marketing
 
Integration of Google Tag Manager and Google Analytics
Integration of Google Tag Manager and Google AnalyticsIntegration of Google Tag Manager and Google Analytics
Integration of Google Tag Manager and Google AnalyticsJatin Kochhar
 
googletagmanager-230602072244-9b17e12b (1).pptx
googletagmanager-230602072244-9b17e12b (1).pptxgoogletagmanager-230602072244-9b17e12b (1).pptx
googletagmanager-230602072244-9b17e12b (1).pptxarthiravi92
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for DevelopersRubén Martínez
 

Similar to Having fun with Google Tag Manager (implement cool things like weather tracking) by Hannah Deakin and Charlotte Upfold (20)

Most Advanced GTM Deployment. Ever!
Most Advanced GTM Deployment. Ever!Most Advanced GTM Deployment. Ever!
Most Advanced GTM Deployment. Ever!
 
All about google tag manager - Basics
All about google tag manager - Basics All about google tag manager - Basics
All about google tag manager - Basics
 
How Google Tag Manager changes everything you knew about website analytics
How Google Tag Manager changes everything you knew about website analyticsHow Google Tag Manager changes everything you knew about website analytics
How Google Tag Manager changes everything you knew about website analytics
 
Crash Course on Google Analytics
Crash Course on Google AnalyticsCrash Course on Google Analytics
Crash Course on Google Analytics
 
Google Tag Manager
Google Tag ManagerGoogle Tag Manager
Google Tag Manager
 
Google Tag Manager for actionable metrics - Beyond basic Google Analytics
Google Tag Manager for actionable metrics - Beyond basic Google AnalyticsGoogle Tag Manager for actionable metrics - Beyond basic Google Analytics
Google Tag Manager for actionable metrics - Beyond basic Google Analytics
 
Introduction to Google Tag Manager
Introduction to Google Tag ManagerIntroduction to Google Tag Manager
Introduction to Google Tag Manager
 
"Taster Slides" for Most advanced GTM implementation
"Taster Slides" for Most advanced GTM implementation"Taster Slides" for Most advanced GTM implementation
"Taster Slides" for Most advanced GTM implementation
 
Google tag manager fundamentals question and answer (june 23 and july 24, 2015)
Google tag manager fundamentals question and answer (june 23 and july 24, 2015)Google tag manager fundamentals question and answer (june 23 and july 24, 2015)
Google tag manager fundamentals question and answer (june 23 and july 24, 2015)
 
Paul Duncan - Advanced Tracking & Enriched SERP Results via Google Tag Manager
Paul Duncan - Advanced Tracking & Enriched SERP Results via Google Tag ManagerPaul Duncan - Advanced Tracking & Enriched SERP Results via Google Tag Manager
Paul Duncan - Advanced Tracking & Enriched SERP Results via Google Tag Manager
 
Expert Tips and Techniques for Using Google Tag Manager
Expert Tips and Techniques  for Using Google Tag ManagerExpert Tips and Techniques  for Using Google Tag Manager
Expert Tips and Techniques for Using Google Tag Manager
 
Lead Score Web Visitors For KILLER Remarketing, Upsell and Exit Intent Strate...
Lead Score Web Visitors For KILLER Remarketing, Upsell and Exit Intent Strate...Lead Score Web Visitors For KILLER Remarketing, Upsell and Exit Intent Strate...
Lead Score Web Visitors For KILLER Remarketing, Upsell and Exit Intent Strate...
 
Marketo: hands on with Google Analytics
Marketo: hands on with Google AnalyticsMarketo: hands on with Google Analytics
Marketo: hands on with Google Analytics
 
Google Tag Manager | Google Tag Manager Tutorial 2019 | Google Tag Manager Se...
Google Tag Manager | Google Tag Manager Tutorial 2019 | Google Tag Manager Se...Google Tag Manager | Google Tag Manager Tutorial 2019 | Google Tag Manager Se...
Google Tag Manager | Google Tag Manager Tutorial 2019 | Google Tag Manager Se...
 
Introduction about Google Tag manager
Introduction about Google Tag manager Introduction about Google Tag manager
Introduction about Google Tag manager
 
Google Analytics - Webmaster Tools Pro Setup & Tips
Google Analytics -  Webmaster Tools Pro Setup & TipsGoogle Analytics -  Webmaster Tools Pro Setup & Tips
Google Analytics - Webmaster Tools Pro Setup & Tips
 
Integration of Google Tag Manager and Google Analytics
Integration of Google Tag Manager and Google AnalyticsIntegration of Google Tag Manager and Google Analytics
Integration of Google Tag Manager and Google Analytics
 
googletagmanager-230602072244-9b17e12b (1).pptx
googletagmanager-230602072244-9b17e12b (1).pptxgoogletagmanager-230602072244-9b17e12b (1).pptx
googletagmanager-230602072244-9b17e12b (1).pptx
 
Google Tag Manager.pptx
Google Tag Manager.pptxGoogle Tag Manager.pptx
Google Tag Manager.pptx
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
 

More from Eventz.Digital

GDPRs, those Pesky Peckers and the E-mail Trail : a look at the law and what ...
GDPRs, those Pesky Peckers and the E-mail Trail : a look at the law and what ...GDPRs, those Pesky Peckers and the E-mail Trail : a look at the law and what ...
GDPRs, those Pesky Peckers and the E-mail Trail : a look at the law and what ...Eventz.Digital
 
Amazon Search Optimization. The Usurper of Search by Daniel Saunders
Amazon Search Optimization. The Usurper of Search by Daniel SaundersAmazon Search Optimization. The Usurper of Search by Daniel Saunders
Amazon Search Optimization. The Usurper of Search by Daniel SaundersEventz.Digital
 
Using content to build Brand by Hannah Thorpe
Using content to build Brand by Hannah ThorpeUsing content to build Brand by Hannah Thorpe
Using content to build Brand by Hannah ThorpeEventz.Digital
 
Blockchain beyond the hype - Trust, decentralisation and the future of busine...
Blockchain beyond the hype - Trust, decentralisation and the future of busine...Blockchain beyond the hype - Trust, decentralisation and the future of busine...
Blockchain beyond the hype - Trust, decentralisation and the future of busine...Eventz.Digital
 
Blackhat tips and advice on how SEO can work for you by Craig Campbell
Blackhat tips and advice on how SEO can work for you by Craig CampbellBlackhat tips and advice on how SEO can work for you by Craig Campbell
Blackhat tips and advice on how SEO can work for you by Craig CampbellEventz.Digital
 
Search and Social: 3 Tricks to Make Your Advertising Work Better Together by ...
Search and Social: 3 Tricks to Make Your Advertising Work Better Together by ...Search and Social: 3 Tricks to Make Your Advertising Work Better Together by ...
Search and Social: 3 Tricks to Make Your Advertising Work Better Together by ...Eventz.Digital
 
Automation for Market Intelligence by Barrie Jarman
Automation for Market Intelligence by Barrie JarmanAutomation for Market Intelligence by Barrie Jarman
Automation for Market Intelligence by Barrie JarmanEventz.Digital
 
What the Best Do Differently (Agencies and Brands) by Robert Craven
What the Best Do Differently (Agencies and Brands) by Robert CravenWhat the Best Do Differently (Agencies and Brands) by Robert Craven
What the Best Do Differently (Agencies and Brands) by Robert CravenEventz.Digital
 
Blink & You’ll Miss It: The Ever-Changing Landscape of Paid Media by Samantha...
Blink & You’ll Miss It: The Ever-Changing Landscape of Paid Media by Samantha...Blink & You’ll Miss It: The Ever-Changing Landscape of Paid Media by Samantha...
Blink & You’ll Miss It: The Ever-Changing Landscape of Paid Media by Samantha...Eventz.Digital
 
The Mobile First Index, what, why and more importantly when! by Jon Myers
The Mobile First Index, what, why and more importantly when! by Jon Myers The Mobile First Index, what, why and more importantly when! by Jon Myers
The Mobile First Index, what, why and more importantly when! by Jon Myers Eventz.Digital
 
What everyone should learn from my 6 years of mistakes with CRO by Duane Brown
What everyone should learn from my 6 years of mistakes with CRO by Duane BrownWhat everyone should learn from my 6 years of mistakes with CRO by Duane Brown
What everyone should learn from my 6 years of mistakes with CRO by Duane BrownEventz.Digital
 
How to Design a Bot Experience Like Your Reputation Depends on it - Ben Scott...
How to Design a Bot Experience Like Your Reputation Depends on it - Ben Scott...How to Design a Bot Experience Like Your Reputation Depends on it - Ben Scott...
How to Design a Bot Experience Like Your Reputation Depends on it - Ben Scott...Eventz.Digital
 
How to Select the Best Keyphrases for Your Marketing Campaigns - andy Headington
How to Select the Best Keyphrases for Your Marketing Campaigns - andy HeadingtonHow to Select the Best Keyphrases for Your Marketing Campaigns - andy Headington
How to Select the Best Keyphrases for Your Marketing Campaigns - andy HeadingtonEventz.Digital
 
How to Dominate Google Maps - Shaun Hudson
How to Dominate Google Maps - Shaun HudsonHow to Dominate Google Maps - Shaun Hudson
How to Dominate Google Maps - Shaun HudsonEventz.Digital
 
Hypothesis focused SEO - Tom Anthony
Hypothesis focused SEO - Tom AnthonyHypothesis focused SEO - Tom Anthony
Hypothesis focused SEO - Tom AnthonyEventz.Digital
 
Social Media Bootcamp - David Harris
Social Media Bootcamp - David HarrisSocial Media Bootcamp - David Harris
Social Media Bootcamp - David HarrisEventz.Digital
 
Rock Your Social Media - David Harris
Rock Your Social Media - David HarrisRock Your Social Media - David Harris
Rock Your Social Media - David HarrisEventz.Digital
 
From Multi-Channel Funnel to Propensity to Buy - Russell McAthy
From Multi-Channel Funnel to Propensity to Buy - Russell McAthyFrom Multi-Channel Funnel to Propensity to Buy - Russell McAthy
From Multi-Channel Funnel to Propensity to Buy - Russell McAthyEventz.Digital
 
SEO Site Clinic - Natalie Mott
SEO Site Clinic - Natalie MottSEO Site Clinic - Natalie Mott
SEO Site Clinic - Natalie MottEventz.Digital
 
Bridging the Gap Between Acquisition and Retention - Samantha Noble
Bridging the Gap Between Acquisition and Retention - Samantha NobleBridging the Gap Between Acquisition and Retention - Samantha Noble
Bridging the Gap Between Acquisition and Retention - Samantha NobleEventz.Digital
 

More from Eventz.Digital (20)

GDPRs, those Pesky Peckers and the E-mail Trail : a look at the law and what ...
GDPRs, those Pesky Peckers and the E-mail Trail : a look at the law and what ...GDPRs, those Pesky Peckers and the E-mail Trail : a look at the law and what ...
GDPRs, those Pesky Peckers and the E-mail Trail : a look at the law and what ...
 
Amazon Search Optimization. The Usurper of Search by Daniel Saunders
Amazon Search Optimization. The Usurper of Search by Daniel SaundersAmazon Search Optimization. The Usurper of Search by Daniel Saunders
Amazon Search Optimization. The Usurper of Search by Daniel Saunders
 
Using content to build Brand by Hannah Thorpe
Using content to build Brand by Hannah ThorpeUsing content to build Brand by Hannah Thorpe
Using content to build Brand by Hannah Thorpe
 
Blockchain beyond the hype - Trust, decentralisation and the future of busine...
Blockchain beyond the hype - Trust, decentralisation and the future of busine...Blockchain beyond the hype - Trust, decentralisation and the future of busine...
Blockchain beyond the hype - Trust, decentralisation and the future of busine...
 
Blackhat tips and advice on how SEO can work for you by Craig Campbell
Blackhat tips and advice on how SEO can work for you by Craig CampbellBlackhat tips and advice on how SEO can work for you by Craig Campbell
Blackhat tips and advice on how SEO can work for you by Craig Campbell
 
Search and Social: 3 Tricks to Make Your Advertising Work Better Together by ...
Search and Social: 3 Tricks to Make Your Advertising Work Better Together by ...Search and Social: 3 Tricks to Make Your Advertising Work Better Together by ...
Search and Social: 3 Tricks to Make Your Advertising Work Better Together by ...
 
Automation for Market Intelligence by Barrie Jarman
Automation for Market Intelligence by Barrie JarmanAutomation for Market Intelligence by Barrie Jarman
Automation for Market Intelligence by Barrie Jarman
 
What the Best Do Differently (Agencies and Brands) by Robert Craven
What the Best Do Differently (Agencies and Brands) by Robert CravenWhat the Best Do Differently (Agencies and Brands) by Robert Craven
What the Best Do Differently (Agencies and Brands) by Robert Craven
 
Blink & You’ll Miss It: The Ever-Changing Landscape of Paid Media by Samantha...
Blink & You’ll Miss It: The Ever-Changing Landscape of Paid Media by Samantha...Blink & You’ll Miss It: The Ever-Changing Landscape of Paid Media by Samantha...
Blink & You’ll Miss It: The Ever-Changing Landscape of Paid Media by Samantha...
 
The Mobile First Index, what, why and more importantly when! by Jon Myers
The Mobile First Index, what, why and more importantly when! by Jon Myers The Mobile First Index, what, why and more importantly when! by Jon Myers
The Mobile First Index, what, why and more importantly when! by Jon Myers
 
What everyone should learn from my 6 years of mistakes with CRO by Duane Brown
What everyone should learn from my 6 years of mistakes with CRO by Duane BrownWhat everyone should learn from my 6 years of mistakes with CRO by Duane Brown
What everyone should learn from my 6 years of mistakes with CRO by Duane Brown
 
How to Design a Bot Experience Like Your Reputation Depends on it - Ben Scott...
How to Design a Bot Experience Like Your Reputation Depends on it - Ben Scott...How to Design a Bot Experience Like Your Reputation Depends on it - Ben Scott...
How to Design a Bot Experience Like Your Reputation Depends on it - Ben Scott...
 
How to Select the Best Keyphrases for Your Marketing Campaigns - andy Headington
How to Select the Best Keyphrases for Your Marketing Campaigns - andy HeadingtonHow to Select the Best Keyphrases for Your Marketing Campaigns - andy Headington
How to Select the Best Keyphrases for Your Marketing Campaigns - andy Headington
 
How to Dominate Google Maps - Shaun Hudson
How to Dominate Google Maps - Shaun HudsonHow to Dominate Google Maps - Shaun Hudson
How to Dominate Google Maps - Shaun Hudson
 
Hypothesis focused SEO - Tom Anthony
Hypothesis focused SEO - Tom AnthonyHypothesis focused SEO - Tom Anthony
Hypothesis focused SEO - Tom Anthony
 
Social Media Bootcamp - David Harris
Social Media Bootcamp - David HarrisSocial Media Bootcamp - David Harris
Social Media Bootcamp - David Harris
 
Rock Your Social Media - David Harris
Rock Your Social Media - David HarrisRock Your Social Media - David Harris
Rock Your Social Media - David Harris
 
From Multi-Channel Funnel to Propensity to Buy - Russell McAthy
From Multi-Channel Funnel to Propensity to Buy - Russell McAthyFrom Multi-Channel Funnel to Propensity to Buy - Russell McAthy
From Multi-Channel Funnel to Propensity to Buy - Russell McAthy
 
SEO Site Clinic - Natalie Mott
SEO Site Clinic - Natalie MottSEO Site Clinic - Natalie Mott
SEO Site Clinic - Natalie Mott
 
Bridging the Gap Between Acquisition and Retention - Samantha Noble
Bridging the Gap Between Acquisition and Retention - Samantha NobleBridging the Gap Between Acquisition and Retention - Samantha Noble
Bridging the Gap Between Acquisition and Retention - Samantha Noble
 

Recently uploaded

Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 

Recently uploaded (20)

CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 

Having fun with Google Tag Manager (implement cool things like weather tracking) by Hannah Deakin and Charlotte Upfold

  • 1. Fun with Google Tag Manager hannah@polkadotdata.com charlotte@polkadotdata.com Hannah Deakin and Charlotte Upfold Polka Dot Data
  • 2. Breaking the ice • Polka Dot Data – we’re the web analytics specialists from Hampshire! • Hannah – Senior Data Technologist • Charlotte – Chief Number Whizz • Participant introduction • Name • Role • Experience level • Something you want to learn • What would your dream lunch be?
  • 3. Just a few of our clients We’ve loved the variety!
  • 4. Project Kick off Call GA & GTM Audits & Updates KPI Dashboard KPI Scope & Mapping What we do for EVERY client: 1 hr Handover Webinar Documentation Channel Guide Expert Support Throughout And most importantly, an amazing GA & GTM implementation!
  • 5. Google Tag Manager – what, why and how? • A tag management system that’s part of the Google Marketing Platform • Google Analytics, DataStudio, Google Optimise, GTM • Integrates really well with GA, AdWords • Also Facebook, Bing, Floodlight – through built-in tags • Can use Custom HTML tags to add in anything that hasn’t yet been integrated • In the old days… • All your tracking code inline on the web page. • Any updates, go through dev • Now… • GTM snippet placed inline on the web page • Devs provide the information through a datalayer – a collection of name-value pairs, information about what the page is showing • GTM tags can replace all other inline tracking code • Decouples dependency between dev and marketing
  • 6. How it all fits together • GTM Container Snippet • DataLayer Website • Tags • Triggers • Variables GTM Container Data! Google Analytics hannah@polkadotdata.com charlotte@polkadotdata.com
  • 7. GTM Concepts: Tags, Triggers and Variables TAGS TRIGGERS VARIABLES • Snippets of code, pre-built or custom • Add customisations to work for you • Rules and scenarios used against each tag to tell it when to fire • Specific details of information that can either be exact, extracted from site, or built to be dynamic. • Referenced in Tags and Triggers hannah@polkadotdata.com charlotte@polkadotdata.com
  • 8. Our Challenge Today Add weather tracking to Google’s Ecommerce demo site • https://enhancedecommerce.appspot.com/ • An online T-Shirt shop • Useful to try out GA enhanced ecommerce yourself, and to see what the code should look like • We’re going to add some tracking of our own to it • Page views • Links clicked • Adding in location information • Weather tracking
  • 9. Trigger- tastic fun Getting set up Variables & the Datalayer Tags at your service Putting it all together hannah@polkadotdata.com charlotte@polkadotdata.com
  • 10. What tools do we need today? • Laptop + WiFi http://bit.ly/gtm_workshop • Chrome + extensions: • Needed: Tag Manager Injector • Nice to have: Google Analytics Debugger Getting set up hannah@polkadotdata.com charlotte@polkadotdata.com
  • 11. Creating a new GTM container • https://marketingplatform.google.com/about/tag-manager/ • Click “Start for Free” • 1) Account Name: My DMSSO Test Container • 2) Container name: enhancedecommerce.appspot.com • 3) Accept t&Cs • 4) Note down or copy your GTM container ID: GTM-xxxxx Getting set up
  • 12. Your new GTM container! • Other nice to haves: A test Google Analytics account Getting set up hannah@polkadotdata.com charlotte@polkadotdata.com
  • 13. Let’s explore some tags • Tags are just snippets of code (prebuilt or custom) • Lots of tag types are already provided • We use “Google Analytics – Universal Analytics” the most and Custom HTML • What other ones catch your eye and are relevant to you? • E.g. Google Ads Remarketing, Awin, Bing, Twitter, Adometry • All the ones provided encapsulate all the code, so you know only need key information • E.g. Account ID, revenue, product ids Tags at your service hannah@polkadotdata.com charlotte@polkadotdata.com
  • 14. Task 1: Create your first tag! • Create new GA PageView tag • Tag type: Google Analytics – Universal Analytics • Track Type: Pageview • Google Analytics settings: New Variable • GA Tracking ID is: UA-123408449-2 • Add a trigger to it to tell it when to fire – “All Pages” to fire on every page Tags at your service
  • 15. GTM preview Task 1: Let’s test the tag works In GTM, click Preview at the top right In Chrome, go to https://enhancedecommerce.appspot.com/ It doesn’t have your GTM container on it at the moment. Let’s add it in! In Chrome, open TagManagerInjector GTM container id: GTM-XXX Include Domain(s): enhancedecommerce.appspot.com Click START In Chrome, hit Ctrl-F5 to refresh the page You should see the GTM preview pop-up in the bottom half of your screen You should see your tag fire – like this: Tag Manager Injector Refresh! Ctrl-F5
  • 17. Let’s explore triggers Triggers are the rules that tell a tag when to fire • Page View based: PageView, Dom Ready, Window Loaded • Click based: All elements, links • User engagement based: e.g. element visibility, form submission • Others – e.g. custom events, javascript errors and timing Can be customised to fire on certain conditions e.g. • Page URL matches a particular RegEx • Click Text equals some text • Custom Javascript variable does not equal true Trigger- tastic fun
  • 18. Task 2: Create a Trigger to fire when Any Link is clicked 1) Create a click based trigger for all links • Name: Click – All Links • Trigger type: Click – Just Links • This trigger fires on: All Link Clicks Trigger- tastic fun
  • 19. Task 3: Create a tag that uses your trigger 1) Create a Google Analytics tag called “GA Link Click Event” Track Type = Event Category = “<Your Name> - Link Click” 2) Assign the new “Click – All Links” trigger to your new GA Event tag 3) Save changes and Preview Trigger- tastic fun
  • 20. How this looks in GTM preview How this looks in GA Trigger- tastic fun TIP! Hold Ctrl while you click to keep it in the tab
  • 21. Let’s explore GTM variables • A GTM variable is a bit of information that can either: • exact (a constant) • dynamic • extracted from site • Within GTM, use double curly-braces to refer to variables: {{variable-name}} • A datalayer is just a collection of name-value pairs: • in human-readable text format (JSON) • GTM accesses a specific datalayer variable – see the GTM snippet • Always push objects to the datalayer, to prevent overwriting Variables & the Datalayer
  • 22. Task 4: Add the link text to your GA event action • In task 3, we created a tag and trigger for a link click • Add the Click Text of the link to the Event Action Clues: • GTM gives you a Built-In Variable to help • Type in double curly braces {{ and GTM will offer you a list to choose from Variables & the Datalayer
  • 23. Task 5: Add location to your GA event label • Let’s add location to the datalayer of the web page ‘location’:’town-name’ • In Tag Manager Injector, add: ‘location’:’Southampton’ • In GTM, get the location datalayer value for your ‘GA Link Click Event’ label field Clues: • It will need a new variable in GTM, not built-in. What type? Variables & the Datalayer
  • 24. Here’s one we built earlier Variables & the Datalayer
  • 25. How this looks in GTM preview How this looks in GA Variables & the Datalayer
  • 26. Almost there, let’s put it all together hannah@polkadotdata.com charlotte@polkadotdata.com
  • 27. Rainy days and sunshine… so I promised you weather tracking https://openweathermap.org/api • OpenWeatherMapAPI is a free API you can query to get the weather • Free to register – gives you an ID • Can run queries from within a browser We will use our “DLV – location” variable to query the API and push weather information into our datalayer! Putting it all together
  • 28. Task 6: Add weather to your datalayer with a Custom HTML tag 1. New Custom HTML tag “Custom HTML – Weather Query” 2. Copy the code from (http://bit.ly/gtm_workshop) weatherTag.txt 3. Set it’s trigger to be your “Click – All Links” trigger Putting it all together
  • 29. <script> (function() { // You need to sign up to OpenWeatherMap for a free account. Once you do, // you will find your APP ID in your account dashboard. var owmAppId = '94d81e5044fc8c17aa4523dedc3c5ca4'; // location comes from the datalayer variable we built earlier var location = {{DLV - location}}; // weatherQuery builds the query string to send to the API. You can try this in your browser var weatherQuery = 'https://api.openweathermap.org/data/2.5/weather?q='+location+',uk&appid=' + owmAppId + '&units=metric'; var protocol = document.location.protocol === 'https' ? 'https' : 'http'; var fetchWeatherData = function() { // This sends the request to the API and waits until the request is complete. // Then it extracts some of the information to the datalayer. jQuery.when(jQuery.getJSON(weatherQuery)).done(function(weatherData) { window.dataLayer.push({ event: 'weatherDone', weather: weatherData.weather[0].main, weatherDescription: weatherData.weather[0].description, temperature: weatherData.main.temp }); }).fail(function(jq, status, message) { console.log('Weather request failed: ' + status + '-' + message); }); }; // Uncomment starred lines below if you want to only query weather every 30 minutes. // Highly recommend this is done when using on a real site. // Add a 1st party cookie variable called "session" and remove space from { {Cookie below // * if (typeof { {Cookie - session alive}} == 'undefined') { console.log('About to fetchWeather for '+ location); fetchWeatherData(); // * } // Reset "session" cookie with a 30-minute expiration // * var d = new Date(); // * d.setTime(d.getTime()+1800000); // * var expires = "expires="+d.toGMTString(); // * document.cookie = "session=1; "+expires+"; path=/"; })(); </script> Sample code for weather tag Please register with OpenWeatherMap API to get your own ID if you want to use this for real!
  • 30. How this looks in GTM preview How this looks in GA Putting it all together
  • 31. Task 7: Create a new GA Weather Event tag and trigger it from the weatherDone event Trigger name: Custom - weatherDone 1. Trigger Type: Custom Event 2. Event Name: weatherDone Tag name: GA Weather Event 1. Track Type: Event 2. Category: <Your name> - weather 3. Action: new variable for “weather” 4. Label: new variable for “temperature”
  • 32. How this looks in GTM preview How this looks in GA Putting it all together
  • 33. Bonus Fun for home: Send weather as custom dimensions to GA • Make sure you have the custom dimensions set up in GA admin • Update your GA Settings variable – with custom dimension 1 set to pull “weather” and custom dimension 2 set to pull “temperature” • You’d probably also want a custom dimension for location • This is harder to test in real-time, but will let you make some awesome reports Putting it all together
  • 34. Finally… 1. You can publish your GTM container by clicking Submit at the top right 2. STOP your Google Tag Manager Injector 
  • 36. Insights from your website Hannah Deakin Charlotte Upfold We’d love to get your feedback, what other courses would you find useful? If you’d like to get in touch please do – our website, email, LinkedIn, Facebook Analytics Training Set up & Auditing Get the most from your website! hannah@polkadotdata.com charlotte@polkadotdata.com

Editor's Notes

  1. Imagine we now want to know where the user was when they clicked this button - perhaps town. Avoid postcode – why? Imagine that on the page, there is a datalayer which contains that information and we want to extract it using GTM to use for our event. It looks like this {‘location’:’town-name’} e.g. {‘location’:’Southampton’} We will use GTM tag injector to mock this up, because we don’t have the Google dev team on hand to add this datalayer to their site… Clues: It will need a new variable in GTM, not built-in. What type? You can add this as the Event label, for your GA event tag. Don’t forget the double curly braces
  2. Imagine we now want to know where the user was when they clicked this button - perhaps town. Avoid postcode – why? Imagine that on the page, there is a datalayer which contains that information and we want to extract it using GTM to use for our event. It looks like this {‘location’:’town-name’} e.g. {‘location’:’Southampton’} We will use GTM tag injector to mock this up, because we don’t have the Google dev team on hand to add this datalayer to their site… Clues: It will need a new variable in GTM, not built-in. What type? You can add this as the Event label, for your GA event tag. Don’t forget the double curly braces