SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
Morphing GA into
an Affiliate Analytics Monster
By Phil Pearce
#MeasureCamp @PHILPEARCE
London
25th March 2017
Warning / Disclaimer
1. GA is design for audience measurement
(not affiliates tracking)
2. Run this on a parallel GA account (not your
main GA account) as it will report very
different numbers and use _ga2 cookie.
3. This is not a simple process…
Pls Download and import this GTM file:
bit.ly/affiliatemonsterdownload
Or use this generic login:
username: coolgtmstuff@gmail.com
password: philrulesgtm7
Select "Affiliate Monster container"
Working Demo
…but, I like to push the
boundaries of what`s possible
(with GA)…
…and I`m a slightly
Mad Analytics Scientist!
Note: It has taken lots of
<body>s to get to this point…
GTM <body>`s from the past...
But it worked!
and… the data came alive :)
Before vs After
Agenda
Agenda
1. Define the problem
– Business Alignment (custom business logic in affiliate industry)
– 1st party vs 3rd party cookies
– GA is whitelisted on Adblocker plus
– Existing affiliateId=123 params ignored by GA (and utm_id not used by affiliates)
2. Solution
– Mapping affiliateId to utm_id
– Overwriting setLocation & setReferral
– DimensionWidening via CSV upload of affiliateId >> source/medium/campaign
3. Learnings/Mistakes
– Enabling utm campaign cookie to prevent session reset on 2nd page
– Accounting for #utm vs ?utm
4. Future improvements
– Organic and Social organic cookie
– Cross-domain tracking of source and affiliateId (#_ga=xxx.xxx pigybacking)
– GoogleSheet for affiliateId DimensionWidening
5. Questions
This is the story of one such
mad Analytics Experiment…
So, new super-affiliate
client just signed!
• GA classic >> GA universal migration via GTM
• 5 CMS environments
(Desktop, New Mobile, Old mobile site, Tablet, Campaign Site)
• utm tags only used on email and banners
• Affiliates 90% of traffic but missing utm tags. Hence, Direct was 80% of traffic!
• Marketing Channel Analysis not possible in GA!!
Source: builtwith.com/detailed/behemothclient.com
5 CMS platforms:
Desktop, New Mobile, Old mobile site,
Tablet and Campaign Site.
Cleaning & Standardise
Equipment before the
big operation
Testing on Mice
1. Parallel Tracker
2. Unit Tests & Sinario Tests
3. Query Time utm_id widening
Alive indefinitely
Unit Test / Mice Test
Code Refinements
1 day Live test
Standardise GTM
SetupAffiliate
Monster
Project Timeline
3 months bring the beast to life
In Reality…
It was really hard!
Insert Picture of
- Phil with no hair
and
- lots of dead mice
But we did get there :)
But about those dead mice…
Why not use native GA?
1. setSource utm field (rather than setLocation)
2. Custom Multi-channel funnels
3. BigQuery sessionisation [GA Prem. feature]
4. GA 6 mth sessions setting changed to 30days
5. utm_nooveride=1 not used
Recipe for a Affiliate Monster
1. Have GTM on all pages
2. Declare affiliateTracker name
3. Declare ga2 object
4. Declare ga2 cookie
5. setLocation override in pageview
6. setReferral override in pageview
7. Be on SSL (or enable meta always send referral)
Mistakes to Avoid
1. cleaning/removing existing utm params
2. Accounting for the order of params
3. #utm vs ?utm or both
4. removing double-quotes
5. JS logic: gclid/dclid >> utm >> affiliateId >>
organic >> social referral >> referral
Pls Download and import this GTM file:
bit.ly/affiliatemonsterdownload
Or use this generic login:
username: coolgtmstuff@gmail.com
password: philrulesgtm7
Select "Affiliate Monster container"
Working Demo
part1: jsv_pageHostnameTLD
function(){
var domain={{Page Hostname - www removed}};
var rootDomain = undefined;
if (domain) {
domain.toLowerCase();
}
if (domain.substring(0,4)=="www.") {
domain=domain.substring(4,domain.length);
}
var domParts = domain.split('.');
for(var i=1;i<=domParts.length;i++)
{
document.cookie="gtmtestcookie1=1; path=/; domain="+domParts.slice(i*-1).join('.');
if(document.cookie.indexOf("gtmtestcookie1") != -1){
var rootDomain = domParts.slice(i*-1).join('.');
document.cookie="gtmtestcookie1=1; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; domain="+domParts.slice(i*-1).join('.');
break;
}
}
return rootDomain;
}
part2:
setCookie for utm_id setTrackingSessionCookie
<script>
function setTrackingSessionCookie(trackingCookieName, cookieValue, cookieDaysDuration) {
var pageHostnameTLD = {{jsv_pageHostnameTLD}};
var cookieExpires = "";
if (cookieDaysDuration) {
var date = new Date();
date.setTime(date.getTime() + (cookieDaysDuration *24*60*60*1000) );
cookieExpires = "; expires=" + date.toGMTString(); // If not provided, it will be a session cookie.
}
// Session SetCookie
if (trackingCookieName && cookieValue) {
document.cookie = trackingCookieName + '=' + cookieValue + cookieExpires + '; domain=' + pageHostnameTLD + '; path=/';
}
};
// Set Based on URL or URL Hash
setTrackingSessionCookie("gclid", {{Page URL Query tracking gclid}} , "30");
setTrackingSessionCookie("dclid", {{Page URL Query tracking dclid}} , "30");
setTrackingSessionCookie("utm_id", {{Page URL Query tracking utm_id}} , "30");
setTrackingSessionCookie("utm_source", {{Page URL Query tracking utm_source}} , "30");
setTrackingSessionCookie("utm_medium", {{Page URL Query tracking utm_medium}} , "30");
setTrackingSessionCookie("utm_campaign", {{Page URL Query tracking utm_campaign}} , "30");
setTrackingSessionCookie("utm_content", {{Page URL Query tracking utm_content}} , "30");
setTrackingSessionCookie("utm_keyword", {{Page URL Query tracking utm_keyword}} , "30");
setTrackingSessionCookie("utm_userid", {{Page URL Query tracking utm_userid}} , "30");
</script>
part3: setLocation
<script>
function setTrackingLocation() {
var pageProtocol = {{Page URL Protocol}};
var pageHostname = {{Page Hostname}};
var pagePath = {{Page Path}};
var pageQuery = {{Page URL Query}};
var referrerHostname = {{Referrer Hostname - www removed}};
var countryCode = {{Lookup CountryCode from Country1 - PP reminder to check DE SH or DESH or SH}};
var deviceType = {{Lookup bespokeDeviceCategory from ContainerID}};
var cookieGoogleClickid = {{cookie gclid}};
var cookieDoubleClickId = {{cookie dclid}};
var cookieUtmId = {{cookie utm_id}};
var cookieUtmSource = {{cookie utm_source}};
var cookieUtmMedium = {{cookie utm_medium}};
var cookieUtmCampaign = {{cookie utm_campaign}};
var cookieUtmContent = {{cookie utm_content}};
var cookieUtmKeyword = {{cookie utm_keyword}};
var cookieAffiliateId = {{cookie affiliateId}};
var cookieIsLandingPageHit = {{cookie session gtm_isLandingPageHit}};
cookieIsLandingPageHit = ( cookieIsLandingPageHit == undefined ) ? "true" : "false";
// 0. Remove double-quote within utm tags... ""textlink"/adcash" to "textlink/adcash"
// 0. Change undefined to empty string so no risk of "utm_source=undefined"
pageQuery = (typeof pageQuery !== 'undefined') ? pageQuery.replace(/["]+/g, '') : "";
cookieAffiliateId = (typeof cookieAffiliateId !== 'undefined') ? cookieAffiliateId.replace(/["]+/g, '') : "";
cookieUtmId = (typeof cookieUtmId !== 'undefined') ? cookieUtmId.replace(/["]+/g, '') : "";
cookieUtmSource = (typeof cookieUtmSource !== 'undefined') ? cookieUtmSource.replace(/["]+/g, '') : "";
cookieUtmMedium = (typeof cookieUtmMedium !== 'undefined') ? cookieUtmMedium.replace(/["]+/g, '') : "";
cookieUtmCampaign = (typeof cookieUtmCampaign !== 'undefined') ? cookieUtmCampaign.replace(/["]+/g, '') : "";
cookieUtmContent = (typeof cookieUtmContent !== 'undefined') ? cookieUtmContent.replace(/["]+/g, '') : "";
cookieUtmKeyword = (typeof cookieUtmKeyword !== 'undefined') ? cookieUtmKeyword.replace(/["]+/g, '') : "";
Part4: isLandingPage cookie check
part5: isLandingPageHit
function() {
return function() {
setTrackingSessionCookie("gtm_isLandingPageHit", "false");
}
}
Part5: Bring it all together
Scripts activated here
{{jsv_setLandingPageHit - TRUE}}
Wins
1. No need to email 1000 Affiliates to re-tag links!
2. No IT dept involvement (all done in GTM)
3. Better cookie retention vs Affiliate cookies
(esp. on Safari)
4. Better internal trust & actionability in GA data
5. Free!
Next iteration
1. Engagement scoring per AffilaiteID
2. utilise affiliateId/gaClientId cross-domain
tracking and better affiliateId retention
3. CRM integration (similar to utmz method)
4. MeasurementProtocol 4 qualified affiliate sales
5. utm_userid respawn on mailchimp email
Questions & Prizes
Phil Pearce
Senior Web Analyst and GTM specialist
phildpearce@gmail.com
linkedin.com/in/philpearce
Web
Analytics
Exchange
mentor
750 GA
questions answered
Tracking
protection
group
Free Prize for the best question(s).
bit.ly/gtmdevguide2 (free)
Prize: GTM developer guide
free!!
bit.ly/gtmdevguide2

Más contenido relacionado

La actualidad más candente

Plan a Digital Analytics Training Strategy for an Analytics Agency
Plan a Digital Analytics Training Strategy for an Analytics AgencyPlan a Digital Analytics Training Strategy for an Analytics Agency
Plan a Digital Analytics Training Strategy for an Analytics AgencyPhil Pearce
 
4 clicks 2 Measurement - Analytics Automation @ SuperWeek
4 clicks 2 Measurement - Analytics Automation @ SuperWeek4 clicks 2 Measurement - Analytics Automation @ SuperWeek
4 clicks 2 Measurement - Analytics Automation @ SuperWeekPhil Pearce
 
29 Advanced Google Tag Manager Tips Every Marketer Should Know
29 Advanced Google Tag Manager Tips Every Marketer Should Know29 Advanced Google Tag Manager Tips Every Marketer Should Know
29 Advanced Google Tag Manager Tips Every Marketer Should KnowMike Arnesen
 
Analytics Tools to improve Customer Insight
Analytics Tools to improve Customer InsightAnalytics Tools to improve Customer Insight
Analytics Tools to improve Customer InsightPhil Pearce
 
Google Data Studio - First impressions @ Measurecamp
Google Data Studio - First impressions @ MeasurecampGoogle Data Studio - First impressions @ Measurecamp
Google Data Studio - First impressions @ MeasurecampPhil Pearce
 
How can a data layer help my seo
How can a data layer help my seoHow can a data layer help my seo
How can a data layer help my seoPhil Pearce
 
CRO analytics - How to Continually Optimise
CRO analytics - How to Continually OptimiseCRO analytics - How to Continually Optimise
CRO analytics - How to Continually OptimisePhil Pearce
 
Blackhat Analytics 3 @ superweek - Do be evil: Force awakens
Blackhat Analytics 3 @  superweek - Do be evil: Force awakensBlackhat Analytics 3 @  superweek - Do be evil: Force awakens
Blackhat Analytics 3 @ superweek - Do be evil: Force awakensPhil Pearce
 
GTM Tools Checklist
GTM Tools ChecklistGTM Tools Checklist
GTM Tools ChecklistPhil Pearce
 
Benefits of Google Tag Manager
Benefits of Google Tag ManagerBenefits of Google Tag Manager
Benefits of Google Tag ManagerPhil Pearce
 
Google Tag Manager For Nerds
Google Tag Manager For NerdsGoogle Tag Manager For Nerds
Google Tag Manager For NerdsSimo Ahava
 
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
 
Rendering SEO (explained by Google's Martin Splitt)
Rendering SEO (explained by Google's Martin Splitt)Rendering SEO (explained by Google's Martin Splitt)
Rendering SEO (explained by Google's Martin Splitt)Anton Shulke
 
Track Everything with Google Tag Manager - #DFWSEM May 2017
Track Everything with Google Tag Manager -  #DFWSEM May 2017Track Everything with Google Tag Manager -  #DFWSEM May 2017
Track Everything with Google Tag Manager - #DFWSEM May 2017Ruth Burr Reedy
 
Introduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePointIntroduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePointGeoff Varosky
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Startedguest1af57e
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićMeetMagentoNY2014
 
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014Bastian Grimm
 
Challenges of building a search engine like web rendering service
Challenges of building a search engine like web rendering serviceChallenges of building a search engine like web rendering service
Challenges of building a search engine like web rendering serviceGiacomo Zecchini
 

La actualidad más candente (20)

Plan a Digital Analytics Training Strategy for an Analytics Agency
Plan a Digital Analytics Training Strategy for an Analytics AgencyPlan a Digital Analytics Training Strategy for an Analytics Agency
Plan a Digital Analytics Training Strategy for an Analytics Agency
 
4 clicks 2 Measurement - Analytics Automation @ SuperWeek
4 clicks 2 Measurement - Analytics Automation @ SuperWeek4 clicks 2 Measurement - Analytics Automation @ SuperWeek
4 clicks 2 Measurement - Analytics Automation @ SuperWeek
 
29 Advanced Google Tag Manager Tips Every Marketer Should Know
29 Advanced Google Tag Manager Tips Every Marketer Should Know29 Advanced Google Tag Manager Tips Every Marketer Should Know
29 Advanced Google Tag Manager Tips Every Marketer Should Know
 
Analytics Tools to improve Customer Insight
Analytics Tools to improve Customer InsightAnalytics Tools to improve Customer Insight
Analytics Tools to improve Customer Insight
 
Google Data Studio - First impressions @ Measurecamp
Google Data Studio - First impressions @ MeasurecampGoogle Data Studio - First impressions @ Measurecamp
Google Data Studio - First impressions @ Measurecamp
 
How can a data layer help my seo
How can a data layer help my seoHow can a data layer help my seo
How can a data layer help my seo
 
CRO analytics - How to Continually Optimise
CRO analytics - How to Continually OptimiseCRO analytics - How to Continually Optimise
CRO analytics - How to Continually Optimise
 
Blackhat Analytics 3 @ superweek - Do be evil: Force awakens
Blackhat Analytics 3 @  superweek - Do be evil: Force awakensBlackhat Analytics 3 @  superweek - Do be evil: Force awakens
Blackhat Analytics 3 @ superweek - Do be evil: Force awakens
 
GTM Tools Checklist
GTM Tools ChecklistGTM Tools Checklist
GTM Tools Checklist
 
Benefits of Google Tag Manager
Benefits of Google Tag ManagerBenefits of Google Tag Manager
Benefits of Google Tag Manager
 
Google Tag Manager For Nerds
Google Tag Manager For NerdsGoogle Tag Manager For Nerds
Google Tag Manager For Nerds
 
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)
 
Rendering SEO (explained by Google's Martin Splitt)
Rendering SEO (explained by Google's Martin Splitt)Rendering SEO (explained by Google's Martin Splitt)
Rendering SEO (explained by Google's Martin Splitt)
 
Track Everything with Google Tag Manager - #DFWSEM May 2017
Track Everything with Google Tag Manager -  #DFWSEM May 2017Track Everything with Google Tag Manager -  #DFWSEM May 2017
Track Everything with Google Tag Manager - #DFWSEM May 2017
 
Introduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePointIntroduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePoint
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Started
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje Jurišić
 
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
 
Challenges of building a search engine like web rendering service
Challenges of building a search engine like web rendering serviceChallenges of building a search engine like web rendering service
Challenges of building a search engine like web rendering service
 
HTML5
HTML5HTML5
HTML5
 

Similar a Morphing GA into an Affiliate Analytics Monster

07 cookies
07 cookies07 cookies
07 cookiessnopteck
 
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
 
Having fun with Google Tag Manager (implement cool things like weather tracki...
Having fun with Google Tag Manager (implement cool things like weather tracki...Having fun with Google Tag Manager (implement cool things like weather tracki...
Having fun with Google Tag Manager (implement cool things like weather tracki...Eventz.Digital
 
Google Optimize for testing and personalization
Google Optimize for testing and personalizationGoogle Optimize for testing and personalization
Google Optimize for testing and personalizationOWOX BI
 
DevFest Chiang Mai - Implementing Google Analytics - 2011-09-24.ppt
DevFest Chiang Mai - Implementing Google Analytics - 2011-09-24.pptDevFest Chiang Mai - Implementing Google Analytics - 2011-09-24.ppt
DevFest Chiang Mai - Implementing Google Analytics - 2011-09-24.pptVinoaj Vijeyakumaar
 
implemetning google analytics - 2011-09-24 Google Devfest Chiangmai
implemetning google analytics - 2011-09-24 Google Devfest Chiangmaiimplemetning google analytics - 2011-09-24 Google Devfest Chiangmai
implemetning google analytics - 2011-09-24 Google Devfest ChiangmaiPawoot (Pom) Pongvitayapanu
 
DevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.ppt
DevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.pptDevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.ppt
DevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.pptVinoaj Vijeyakumaar
 
Questioning Data Quality and Troubleshooting Tracking Gaps (SMX Munich 2020)
Questioning Data Quality and Troubleshooting Tracking Gaps (SMX Munich 2020)Questioning Data Quality and Troubleshooting Tracking Gaps (SMX Munich 2020)
Questioning Data Quality and Troubleshooting Tracking Gaps (SMX Munich 2020)Christopher Gutknecht
 
How to Pass the Google Analytics Individual Qualification Test by Slingshot SEO
How to Pass the  Google Analytics Individual Qualification Test by Slingshot SEOHow to Pass the  Google Analytics Individual Qualification Test by Slingshot SEO
How to Pass the Google Analytics Individual Qualification Test by Slingshot SEOAarif Nazir
 
GTUG Philippines - Implementing Google Analytics - 2011-10-11
GTUG Philippines - Implementing Google Analytics - 2011-10-11GTUG Philippines - Implementing Google Analytics - 2011-10-11
GTUG Philippines - Implementing Google Analytics - 2011-10-11Vinoaj Vijeyakumaar
 
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
 
Questioning data quality and troubleshooting tracking gaps (version2 | Smx Su...
Questioning data quality and troubleshooting tracking gaps (version2 | Smx Su...Questioning data quality and troubleshooting tracking gaps (version2 | Smx Su...
Questioning data quality and troubleshooting tracking gaps (version2 | Smx Su...Christopher Gutknecht
 
Мастеркласс по GTM на Google Event
Мастеркласс по GTM на Google EventМастеркласс по GTM на Google Event
Мастеркласс по GTM на Google EventKirill Bushev
 
Blackhat Analytics - DarkScore test to printout
Blackhat Analytics - DarkScore test to printoutBlackhat Analytics - DarkScore test to printout
Blackhat Analytics - DarkScore test to printoutPhil Pearce
 
Reutov, yunusov, nagibin random numbers take ii
Reutov, yunusov, nagibin   random numbers take iiReutov, yunusov, nagibin   random numbers take ii
Reutov, yunusov, nagibin random numbers take iiDefconRussia
 
Blackhat Analytics 2 @ Superweek
Blackhat Analytics 2  @ SuperweekBlackhat Analytics 2  @ Superweek
Blackhat Analytics 2 @ SuperweekPhil Pearce
 
Consent mode - from zero to hero
Consent mode - from zero to heroConsent mode - from zero to hero
Consent mode - from zero to heroMichal Blažek
 
Google Analytics for Beginners - Training
Google Analytics for Beginners - TrainingGoogle Analytics for Beginners - Training
Google Analytics for Beginners - TrainingRuben Vezzoli
 

Similar a Morphing GA into an Affiliate Analytics Monster (20)

07 cookies
07 cookies07 cookies
07 cookies
 
All about google tag manager - Basics
All about google tag manager - Basics All about google tag manager - Basics
All about google tag manager - Basics
 
Having fun with Google Tag Manager (implement cool things like weather tracki...
Having fun with Google Tag Manager (implement cool things like weather tracki...Having fun with Google Tag Manager (implement cool things like weather tracki...
Having fun with Google Tag Manager (implement cool things like weather tracki...
 
Google Optimize for testing and personalization
Google Optimize for testing and personalizationGoogle Optimize for testing and personalization
Google Optimize for testing and personalization
 
DevFest Chiang Mai - Implementing Google Analytics - 2011-09-24.ppt
DevFest Chiang Mai - Implementing Google Analytics - 2011-09-24.pptDevFest Chiang Mai - Implementing Google Analytics - 2011-09-24.ppt
DevFest Chiang Mai - Implementing Google Analytics - 2011-09-24.ppt
 
implemetning google analytics - 2011-09-24 Google Devfest Chiangmai
implemetning google analytics - 2011-09-24 Google Devfest Chiangmaiimplemetning google analytics - 2011-09-24 Google Devfest Chiangmai
implemetning google analytics - 2011-09-24 Google Devfest Chiangmai
 
DevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.ppt
DevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.pptDevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.ppt
DevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.ppt
 
Questioning Data Quality and Troubleshooting Tracking Gaps (SMX Munich 2020)
Questioning Data Quality and Troubleshooting Tracking Gaps (SMX Munich 2020)Questioning Data Quality and Troubleshooting Tracking Gaps (SMX Munich 2020)
Questioning Data Quality and Troubleshooting Tracking Gaps (SMX Munich 2020)
 
How to Pass the Google Analytics Individual Qualification Test by Slingshot SEO
How to Pass the  Google Analytics Individual Qualification Test by Slingshot SEOHow to Pass the  Google Analytics Individual Qualification Test by Slingshot SEO
How to Pass the Google Analytics Individual Qualification Test by Slingshot SEO
 
GTUG Philippines - Implementing Google Analytics - 2011-10-11
GTUG Philippines - Implementing Google Analytics - 2011-10-11GTUG Philippines - Implementing Google Analytics - 2011-10-11
GTUG Philippines - Implementing Google Analytics - 2011-10-11
 
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
 
Questioning data quality and troubleshooting tracking gaps (version2 | Smx Su...
Questioning data quality and troubleshooting tracking gaps (version2 | Smx Su...Questioning data quality and troubleshooting tracking gaps (version2 | Smx Su...
Questioning data quality and troubleshooting tracking gaps (version2 | Smx Su...
 
Мастеркласс по GTM на Google Event
Мастеркласс по GTM на Google EventМастеркласс по GTM на Google Event
Мастеркласс по GTM на Google Event
 
Blackhat Analytics - DarkScore test to printout
Blackhat Analytics - DarkScore test to printoutBlackhat Analytics - DarkScore test to printout
Blackhat Analytics - DarkScore test to printout
 
Reutov, yunusov, nagibin random numbers take ii
Reutov, yunusov, nagibin   random numbers take iiReutov, yunusov, nagibin   random numbers take ii
Reutov, yunusov, nagibin random numbers take ii
 
Random numbers
Random numbersRandom numbers
Random numbers
 
Blackhat Analytics 2 @ Superweek
Blackhat Analytics 2  @ SuperweekBlackhat Analytics 2  @ Superweek
Blackhat Analytics 2 @ Superweek
 
Consent mode - from zero to hero
Consent mode - from zero to heroConsent mode - from zero to hero
Consent mode - from zero to hero
 
Google Analytics for Beginners - Training
Google Analytics for Beginners - TrainingGoogle Analytics for Beginners - Training
Google Analytics for Beginners - Training
 
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessions
 

Más de Phil Pearce

Photos of LaserBowling @ MeasureCamp Cardiff 2
Photos of LaserBowling @ MeasureCamp Cardiff 2Photos of LaserBowling @ MeasureCamp Cardiff 2
Photos of LaserBowling @ MeasureCamp Cardiff 2Phil Pearce
 
Measurebowling Nerdshirts 2017-06-08
Measurebowling Nerdshirts 2017-06-08Measurebowling Nerdshirts 2017-06-08
Measurebowling Nerdshirts 2017-06-08Phil Pearce
 
The Kamasutra of GTM container positions
The Kamasutra of GTM container positionsThe Kamasutra of GTM container positions
The Kamasutra of GTM container positionsPhil Pearce
 
Common mistakes with media tagging (utm tags) and how to fix them!
Common mistakes with media tagging (utm tags) and how to fix them!Common mistakes with media tagging (utm tags) and how to fix them!
Common mistakes with media tagging (utm tags) and how to fix them!Phil Pearce
 
QR code uses cases & Digital Marketing podcasts
QR code uses cases & Digital Marketing podcastsQR code uses cases & Digital Marketing podcasts
QR code uses cases & Digital Marketing podcastsPhil Pearce
 
Analytics Crystal maze
Analytics Crystal mazeAnalytics Crystal maze
Analytics Crystal mazePhil Pearce
 
Example cookie compliance audit
Example cookie compliance auditExample cookie compliance audit
Example cookie compliance auditPhil Pearce
 
Example SEO audit
Example SEO auditExample SEO audit
Example SEO auditPhil Pearce
 
Clicktale Vendor Privacy Audit (August 2013)
Clicktale Vendor Privacy Audit (August 2013)Clicktale Vendor Privacy Audit (August 2013)
Clicktale Vendor Privacy Audit (August 2013)Phil Pearce
 
SEO analytics: How to report & improve performance
SEO analytics: How to report & improve performanceSEO analytics: How to report & improve performance
SEO analytics: How to report & improve performancePhil Pearce
 
Analytics & Optimisation for University sites
Analytics & Optimisation for University sitesAnalytics & Optimisation for University sites
Analytics & Optimisation for University sitesPhil Pearce
 
Digital analytics upskilling & career tips
Digital analytics upskilling & career tipsDigital analytics upskilling & career tips
Digital analytics upskilling & career tipsPhil Pearce
 
Hard PPC questions for the Panel
Hard PPC questions for the PanelHard PPC questions for the Panel
Hard PPC questions for the PanelPhil Pearce
 
Google Tag Manager Flash Tips @ MeasureCamp
Google Tag Manager Flash Tips @ MeasureCampGoogle Tag Manager Flash Tips @ MeasureCamp
Google Tag Manager Flash Tips @ MeasureCampPhil Pearce
 
Realtime Google Analytics game
Realtime Google Analytics gameRealtime Google Analytics game
Realtime Google Analytics gamePhil Pearce
 
Top 10 Google Analytics tips to save you money!
Top 10 Google Analytics tips to save you money!Top 10 Google Analytics tips to save you money!
Top 10 Google Analytics tips to save you money!Phil Pearce
 
Monetate Implementation Cheat Sheet
Monetate Implementation Cheat SheetMonetate Implementation Cheat Sheet
Monetate Implementation Cheat SheetPhil Pearce
 

Más de Phil Pearce (17)

Photos of LaserBowling @ MeasureCamp Cardiff 2
Photos of LaserBowling @ MeasureCamp Cardiff 2Photos of LaserBowling @ MeasureCamp Cardiff 2
Photos of LaserBowling @ MeasureCamp Cardiff 2
 
Measurebowling Nerdshirts 2017-06-08
Measurebowling Nerdshirts 2017-06-08Measurebowling Nerdshirts 2017-06-08
Measurebowling Nerdshirts 2017-06-08
 
The Kamasutra of GTM container positions
The Kamasutra of GTM container positionsThe Kamasutra of GTM container positions
The Kamasutra of GTM container positions
 
Common mistakes with media tagging (utm tags) and how to fix them!
Common mistakes with media tagging (utm tags) and how to fix them!Common mistakes with media tagging (utm tags) and how to fix them!
Common mistakes with media tagging (utm tags) and how to fix them!
 
QR code uses cases & Digital Marketing podcasts
QR code uses cases & Digital Marketing podcastsQR code uses cases & Digital Marketing podcasts
QR code uses cases & Digital Marketing podcasts
 
Analytics Crystal maze
Analytics Crystal mazeAnalytics Crystal maze
Analytics Crystal maze
 
Example cookie compliance audit
Example cookie compliance auditExample cookie compliance audit
Example cookie compliance audit
 
Example SEO audit
Example SEO auditExample SEO audit
Example SEO audit
 
Clicktale Vendor Privacy Audit (August 2013)
Clicktale Vendor Privacy Audit (August 2013)Clicktale Vendor Privacy Audit (August 2013)
Clicktale Vendor Privacy Audit (August 2013)
 
SEO analytics: How to report & improve performance
SEO analytics: How to report & improve performanceSEO analytics: How to report & improve performance
SEO analytics: How to report & improve performance
 
Analytics & Optimisation for University sites
Analytics & Optimisation for University sitesAnalytics & Optimisation for University sites
Analytics & Optimisation for University sites
 
Digital analytics upskilling & career tips
Digital analytics upskilling & career tipsDigital analytics upskilling & career tips
Digital analytics upskilling & career tips
 
Hard PPC questions for the Panel
Hard PPC questions for the PanelHard PPC questions for the Panel
Hard PPC questions for the Panel
 
Google Tag Manager Flash Tips @ MeasureCamp
Google Tag Manager Flash Tips @ MeasureCampGoogle Tag Manager Flash Tips @ MeasureCamp
Google Tag Manager Flash Tips @ MeasureCamp
 
Realtime Google Analytics game
Realtime Google Analytics gameRealtime Google Analytics game
Realtime Google Analytics game
 
Top 10 Google Analytics tips to save you money!
Top 10 Google Analytics tips to save you money!Top 10 Google Analytics tips to save you money!
Top 10 Google Analytics tips to save you money!
 
Monetate Implementation Cheat Sheet
Monetate Implementation Cheat SheetMonetate Implementation Cheat Sheet
Monetate Implementation Cheat Sheet
 

Último

Rithik Kumar Singh codealpha pythohn.pdf
Rithik Kumar Singh codealpha pythohn.pdfRithik Kumar Singh codealpha pythohn.pdf
Rithik Kumar Singh codealpha pythohn.pdfrahulyadav957181
 
Decoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectDecoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectBoston Institute of Analytics
 
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Boston Institute of Analytics
 
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Boston Institute of Analytics
 
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...boychatmate1
 
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdfWorld Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdfsimulationsindia
 
Role of Consumer Insights in business transformation
Role of Consumer Insights in business transformationRole of Consumer Insights in business transformation
Role of Consumer Insights in business transformationAnnie Melnic
 
What To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxWhat To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxSimranPal17
 
DATA ANALYSIS using various data sets like shoping data set etc
DATA ANALYSIS using various data sets like shoping data set etcDATA ANALYSIS using various data sets like shoping data set etc
DATA ANALYSIS using various data sets like shoping data set etclalithasri22
 
Digital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksDigital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksdeepakthakur548787
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Cathrine Wilhelmsen
 
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBoston Institute of Analytics
 
Statistics For Management by Richard I. Levin 8ed.pdf
Statistics For Management by Richard I. Levin 8ed.pdfStatistics For Management by Richard I. Levin 8ed.pdf
Statistics For Management by Richard I. Levin 8ed.pdfnikeshsingh56
 
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...Dr Arash Najmaei ( Phd., MBA, BSc)
 
knowledge representation in artificial intelligence
knowledge representation in artificial intelligenceknowledge representation in artificial intelligence
knowledge representation in artificial intelligencePriyadharshiniG41
 
Digital Indonesia Report 2024 by We Are Social .pdf
Digital Indonesia Report 2024 by We Are Social .pdfDigital Indonesia Report 2024 by We Are Social .pdf
Digital Indonesia Report 2024 by We Are Social .pdfNicoChristianSunaryo
 
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis model
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis modelDecoding Movie Sentiments: Analyzing Reviews with Data Analysis model
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis modelBoston Institute of Analytics
 

Último (20)

Rithik Kumar Singh codealpha pythohn.pdf
Rithik Kumar Singh codealpha pythohn.pdfRithik Kumar Singh codealpha pythohn.pdf
Rithik Kumar Singh codealpha pythohn.pdf
 
Decoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis ProjectDecoding Patterns: Customer Churn Prediction Data Analysis Project
Decoding Patterns: Customer Churn Prediction Data Analysis Project
 
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
Data Analysis Project : Targeting the Right Customers, Presentation on Bank M...
 
2023 Survey Shows Dip in High School E-Cigarette Use
2023 Survey Shows Dip in High School E-Cigarette Use2023 Survey Shows Dip in High School E-Cigarette Use
2023 Survey Shows Dip in High School E-Cigarette Use
 
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
 
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
Introduction to Mongo DB-open-­‐source, high-­‐performance, document-­‐orient...
 
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdfWorld Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
World Economic Forum Metaverse Ecosystem By Utpal Chakraborty.pdf
 
Data Analysis Project: Stroke Prediction
Data Analysis Project: Stroke PredictionData Analysis Project: Stroke Prediction
Data Analysis Project: Stroke Prediction
 
Role of Consumer Insights in business transformation
Role of Consumer Insights in business transformationRole of Consumer Insights in business transformation
Role of Consumer Insights in business transformation
 
What To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxWhat To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptx
 
DATA ANALYSIS using various data sets like shoping data set etc
DATA ANALYSIS using various data sets like shoping data set etcDATA ANALYSIS using various data sets like shoping data set etc
DATA ANALYSIS using various data sets like shoping data set etc
 
Digital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksDigital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing works
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)
 
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis ProjectBank Loan Approval Analysis: A Comprehensive Data Analysis Project
Bank Loan Approval Analysis: A Comprehensive Data Analysis Project
 
Insurance Churn Prediction Data Analysis Project
Insurance Churn Prediction Data Analysis ProjectInsurance Churn Prediction Data Analysis Project
Insurance Churn Prediction Data Analysis Project
 
Statistics For Management by Richard I. Levin 8ed.pdf
Statistics For Management by Richard I. Levin 8ed.pdfStatistics For Management by Richard I. Levin 8ed.pdf
Statistics For Management by Richard I. Levin 8ed.pdf
 
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
6 Tips for Interpretable Topic Models _ by Nicha Ruchirawat _ Towards Data Sc...
 
knowledge representation in artificial intelligence
knowledge representation in artificial intelligenceknowledge representation in artificial intelligence
knowledge representation in artificial intelligence
 
Digital Indonesia Report 2024 by We Are Social .pdf
Digital Indonesia Report 2024 by We Are Social .pdfDigital Indonesia Report 2024 by We Are Social .pdf
Digital Indonesia Report 2024 by We Are Social .pdf
 
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis model
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis modelDecoding Movie Sentiments: Analyzing Reviews with Data Analysis model
Decoding Movie Sentiments: Analyzing Reviews with Data Analysis model
 

Morphing GA into an Affiliate Analytics Monster

  • 1. Morphing GA into an Affiliate Analytics Monster By Phil Pearce #MeasureCamp @PHILPEARCE London 25th March 2017
  • 2. Warning / Disclaimer 1. GA is design for audience measurement (not affiliates tracking) 2. Run this on a parallel GA account (not your main GA account) as it will report very different numbers and use _ga2 cookie. 3. This is not a simple process…
  • 3. Pls Download and import this GTM file: bit.ly/affiliatemonsterdownload Or use this generic login: username: coolgtmstuff@gmail.com password: philrulesgtm7 Select "Affiliate Monster container" Working Demo
  • 4. …but, I like to push the boundaries of what`s possible (with GA)…
  • 5. …and I`m a slightly Mad Analytics Scientist!
  • 6. Note: It has taken lots of <body>s to get to this point…
  • 7. GTM <body>`s from the past...
  • 8. But it worked! and… the data came alive :)
  • 11. Agenda 1. Define the problem – Business Alignment (custom business logic in affiliate industry) – 1st party vs 3rd party cookies – GA is whitelisted on Adblocker plus – Existing affiliateId=123 params ignored by GA (and utm_id not used by affiliates) 2. Solution – Mapping affiliateId to utm_id – Overwriting setLocation & setReferral – DimensionWidening via CSV upload of affiliateId >> source/medium/campaign 3. Learnings/Mistakes – Enabling utm campaign cookie to prevent session reset on 2nd page – Accounting for #utm vs ?utm 4. Future improvements – Organic and Social organic cookie – Cross-domain tracking of source and affiliateId (#_ga=xxx.xxx pigybacking) – GoogleSheet for affiliateId DimensionWidening 5. Questions
  • 12. This is the story of one such mad Analytics Experiment…
  • 13. So, new super-affiliate client just signed! • GA classic >> GA universal migration via GTM • 5 CMS environments (Desktop, New Mobile, Old mobile site, Tablet, Campaign Site) • utm tags only used on email and banners • Affiliates 90% of traffic but missing utm tags. Hence, Direct was 80% of traffic! • Marketing Channel Analysis not possible in GA!!
  • 14. Source: builtwith.com/detailed/behemothclient.com 5 CMS platforms: Desktop, New Mobile, Old mobile site, Tablet and Campaign Site. Cleaning & Standardise Equipment before the big operation
  • 15. Testing on Mice 1. Parallel Tracker 2. Unit Tests & Sinario Tests 3. Query Time utm_id widening
  • 16. Alive indefinitely Unit Test / Mice Test Code Refinements 1 day Live test Standardise GTM SetupAffiliate Monster Project Timeline 3 months bring the beast to life
  • 17. In Reality… It was really hard! Insert Picture of - Phil with no hair and - lots of dead mice
  • 18. But we did get there :) But about those dead mice…
  • 19. Why not use native GA? 1. setSource utm field (rather than setLocation) 2. Custom Multi-channel funnels 3. BigQuery sessionisation [GA Prem. feature] 4. GA 6 mth sessions setting changed to 30days 5. utm_nooveride=1 not used
  • 20. Recipe for a Affiliate Monster 1. Have GTM on all pages 2. Declare affiliateTracker name 3. Declare ga2 object 4. Declare ga2 cookie 5. setLocation override in pageview 6. setReferral override in pageview 7. Be on SSL (or enable meta always send referral)
  • 21. Mistakes to Avoid 1. cleaning/removing existing utm params 2. Accounting for the order of params 3. #utm vs ?utm or both 4. removing double-quotes 5. JS logic: gclid/dclid >> utm >> affiliateId >> organic >> social referral >> referral
  • 22. Pls Download and import this GTM file: bit.ly/affiliatemonsterdownload Or use this generic login: username: coolgtmstuff@gmail.com password: philrulesgtm7 Select "Affiliate Monster container" Working Demo
  • 23. part1: jsv_pageHostnameTLD function(){ var domain={{Page Hostname - www removed}}; var rootDomain = undefined; if (domain) { domain.toLowerCase(); } if (domain.substring(0,4)=="www.") { domain=domain.substring(4,domain.length); } var domParts = domain.split('.'); for(var i=1;i<=domParts.length;i++) { document.cookie="gtmtestcookie1=1; path=/; domain="+domParts.slice(i*-1).join('.'); if(document.cookie.indexOf("gtmtestcookie1") != -1){ var rootDomain = domParts.slice(i*-1).join('.'); document.cookie="gtmtestcookie1=1; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; domain="+domParts.slice(i*-1).join('.'); break; } } return rootDomain; }
  • 24. part2: setCookie for utm_id setTrackingSessionCookie <script> function setTrackingSessionCookie(trackingCookieName, cookieValue, cookieDaysDuration) { var pageHostnameTLD = {{jsv_pageHostnameTLD}}; var cookieExpires = ""; if (cookieDaysDuration) { var date = new Date(); date.setTime(date.getTime() + (cookieDaysDuration *24*60*60*1000) ); cookieExpires = "; expires=" + date.toGMTString(); // If not provided, it will be a session cookie. } // Session SetCookie if (trackingCookieName && cookieValue) { document.cookie = trackingCookieName + '=' + cookieValue + cookieExpires + '; domain=' + pageHostnameTLD + '; path=/'; } }; // Set Based on URL or URL Hash setTrackingSessionCookie("gclid", {{Page URL Query tracking gclid}} , "30"); setTrackingSessionCookie("dclid", {{Page URL Query tracking dclid}} , "30"); setTrackingSessionCookie("utm_id", {{Page URL Query tracking utm_id}} , "30"); setTrackingSessionCookie("utm_source", {{Page URL Query tracking utm_source}} , "30"); setTrackingSessionCookie("utm_medium", {{Page URL Query tracking utm_medium}} , "30"); setTrackingSessionCookie("utm_campaign", {{Page URL Query tracking utm_campaign}} , "30"); setTrackingSessionCookie("utm_content", {{Page URL Query tracking utm_content}} , "30"); setTrackingSessionCookie("utm_keyword", {{Page URL Query tracking utm_keyword}} , "30"); setTrackingSessionCookie("utm_userid", {{Page URL Query tracking utm_userid}} , "30"); </script>
  • 25. part3: setLocation <script> function setTrackingLocation() { var pageProtocol = {{Page URL Protocol}}; var pageHostname = {{Page Hostname}}; var pagePath = {{Page Path}}; var pageQuery = {{Page URL Query}}; var referrerHostname = {{Referrer Hostname - www removed}}; var countryCode = {{Lookup CountryCode from Country1 - PP reminder to check DE SH or DESH or SH}}; var deviceType = {{Lookup bespokeDeviceCategory from ContainerID}}; var cookieGoogleClickid = {{cookie gclid}}; var cookieDoubleClickId = {{cookie dclid}}; var cookieUtmId = {{cookie utm_id}}; var cookieUtmSource = {{cookie utm_source}}; var cookieUtmMedium = {{cookie utm_medium}}; var cookieUtmCampaign = {{cookie utm_campaign}}; var cookieUtmContent = {{cookie utm_content}}; var cookieUtmKeyword = {{cookie utm_keyword}}; var cookieAffiliateId = {{cookie affiliateId}}; var cookieIsLandingPageHit = {{cookie session gtm_isLandingPageHit}}; cookieIsLandingPageHit = ( cookieIsLandingPageHit == undefined ) ? "true" : "false"; // 0. Remove double-quote within utm tags... ""textlink"/adcash" to "textlink/adcash" // 0. Change undefined to empty string so no risk of "utm_source=undefined" pageQuery = (typeof pageQuery !== 'undefined') ? pageQuery.replace(/["]+/g, '') : ""; cookieAffiliateId = (typeof cookieAffiliateId !== 'undefined') ? cookieAffiliateId.replace(/["]+/g, '') : ""; cookieUtmId = (typeof cookieUtmId !== 'undefined') ? cookieUtmId.replace(/["]+/g, '') : ""; cookieUtmSource = (typeof cookieUtmSource !== 'undefined') ? cookieUtmSource.replace(/["]+/g, '') : ""; cookieUtmMedium = (typeof cookieUtmMedium !== 'undefined') ? cookieUtmMedium.replace(/["]+/g, '') : ""; cookieUtmCampaign = (typeof cookieUtmCampaign !== 'undefined') ? cookieUtmCampaign.replace(/["]+/g, '') : ""; cookieUtmContent = (typeof cookieUtmContent !== 'undefined') ? cookieUtmContent.replace(/["]+/g, '') : ""; cookieUtmKeyword = (typeof cookieUtmKeyword !== 'undefined') ? cookieUtmKeyword.replace(/["]+/g, '') : "";
  • 27. part5: isLandingPageHit function() { return function() { setTrackingSessionCookie("gtm_isLandingPageHit", "false"); } }
  • 28. Part5: Bring it all together Scripts activated here {{jsv_setLandingPageHit - TRUE}}
  • 29. Wins 1. No need to email 1000 Affiliates to re-tag links! 2. No IT dept involvement (all done in GTM) 3. Better cookie retention vs Affiliate cookies (esp. on Safari) 4. Better internal trust & actionability in GA data 5. Free!
  • 30. Next iteration 1. Engagement scoring per AffilaiteID 2. utilise affiliateId/gaClientId cross-domain tracking and better affiliateId retention 3. CRM integration (similar to utmz method) 4. MeasurementProtocol 4 qualified affiliate sales 5. utm_userid respawn on mailchimp email
  • 31. Questions & Prizes Phil Pearce Senior Web Analyst and GTM specialist phildpearce@gmail.com linkedin.com/in/philpearce Web Analytics Exchange mentor 750 GA questions answered Tracking protection group Free Prize for the best question(s).
  • 32. bit.ly/gtmdevguide2 (free) Prize: GTM developer guide free!! bit.ly/gtmdevguide2