SlideShare une entreprise Scribd logo
1  sur  27
Adobe Analytics
implementation secret hacks
Alban Gérôme
MeasureCamp London XI
23 September 2017
The basics
Pageviews tracking
s.pageName="homepage";
s.channel="home";
s.prop1="home";
s.t();
Click tracking
document.getElementByID("mybutton").addEventListener(
"click", function(){
s.linkTrackVars="channel";
s.linkTrackEvents="None";
s.tl(true, "o", "my button was clicked");
}
);
Page views tracking gotcha
s.pageName="home";
s.channel="home";
s.prop1="home";
s.t();
s.pageName="products page 1";
s.channel="products";
s.t();
Once declared, a prop remains declared…
… unless you reset it explicitly or load a
new page. This is also true for eVars,
events etc
I am not talking about how eVars persist
but about what your browser remembers
The overrides syntax
Pageviews tracking
s.pageName="homepage";
s.channel="home";
s.prop1="home";
s.t();
Overrides syntax
s.t({
pageName:"homepage",
channel:"home",
prop1:"home"
});
Click tracking
document.getElementByID("mybutton").addEventListener(
"click", function(){
s.linkTrackVars="prop2";
s.prop2="test";
s.linkTrackEvents="None";
s.tl(true, "o", "my button was clicked");
}
);
Overrides syntax
document.getElementByID("mybutton").addEventListener(
"click", function(){
s.linkTrackVars="channel";
s.linkTrackEvents="None";
s.tl(true, "o", "my button was clicked",{prop2:"test"});
}
);
Page views tracking revisited
s.t({
pageName:"home",
channel:"home",
prop1:"home"
});
s.t({
pageName:"products page 1",
channel:"products"
});
When you use the overrides syntax
Adobe Analytics keeps your props private
Private and public data points
Classic syntax = public
s.pageName="homepage";
s.channel="home";
s.prop1="home";
s.t();
Your browser remembers the
values of s.pageName,
s.channel and s.prop1
Overrides syntax = private
s.t({
pageName:"homepage",
channel:"home",
prop1:"home"
});
Your browser sends the request and remembers nothing
so you no longer need to clear your props, eVars, events
etc when using virtual page views
Your props inside the s_code act as
global constants if declared in the
s_doPlugins function
s_code globals and constants
• Declared inside the s_code but outside the s_doPlugins function
Your props, eVars, events etc can be overridden by your page code
• Declared inside the s_code, inside the s_doPlugins function
Your props, eVars, events are protected and cannot be overwritten
You can combine props in your s_code
file, in your page code using the classic
syntax and props using overrides
The 3-layer onion
s.t() using the overrides syntax for all props, eVars,
events etc that are only relevant to the virtual page view you
want to fire
You can declare all props, eVars and events you share across
all views displayed since the initial full page load using the
classic syntax, they will ride on the same page view
request as your overrides s.t() call
All site-wide props, eVars and events should be declared in
the s_code, outside the s_doPlugins function if you need
to overwrite them on specific pages, inside if you want them
protected and read-only
The onion challenge #1
prop1 was declared:
• In the s_code with s.prop1="A" outside the s_doPlugins function
• In the page code with s.prop1="B"
• Inside the s.t() function with s.t({prop1:"C"});
Which value gets passed to the Adobe servers?
Which value does the browser remember after the s.t() call fired?
The onion challenge #2
prop2 was declared:
• In the s_code with s.prop2="A" inside the s_doPlugins function
• In the page code with s.prop2="B"
• Inside the s.t() function with s.t({prop2:"C"});
Which value gets passed to the Adobe servers?
Which value does the browser remember after the s.t() call fired?
Don’t get me wrong, you do need to track
interactions… you just don’t need s.tl
s.t() can fake s.tl() calls
document.querySelector("button").addEventListener(
"click", function(){
s.t({
lnk : true,
linkTrackVars : "channel,prop1,prop2,prop3",
linkTrackEvents : "None",
linkName : "Button was clicked",
linkType : "o",
pageName : dataLayer.pageName,
channel : dataLayer.channel,
prop1 : dataLayer.prop1,
prop2 : dataLayer.prop2,
prop3 : dataLayer.prop3
});
}
);
For the full list of overrides syntax
properties just look inside what
s.vl_g or s.va_g contains
Callbacks for page view tracking
The s_doPlugins function executes every time you are about to track a
page view with s.t()
You can use that function to call a direct call rule declared in DTM for
example in response to each page view or to fire a custom Javascript
event
It seems to work if you s.t() using the classic syntax but not the
overrides syntax
Callbacks for page view tracking
AppMeasurement 1.8.0 released on 19 Jan 2017 introduced these:
• s.registerPreTrackCallback() – will fire a function before the s.t()
call
• s.registerPostTrackCallback() – same as above but after the s.t()
call
• Do not call these inside the s_doPlugins function
• Do not call s.t() or s.tl() inside the callback functions or you will
get infinite loops and rack up infinite server calls!
Callbacks for all tracking
If you are on s_code H* and using the overrides syntax for the s.t()
function, there’s still a way. It is risky and not supported by Adobe as
you will need to modify code in the Do Not Modify part of the s_code
It contains a function called s.mr() which stands for “make request”.
It builds the entire URL for your request and sends it
Before im.src=rs; and/or after
Pre and post callbacks with
s.mr()
var preTrackCallBacks = [];
var postTrackCallBacks = [];
…
//inside the s.mr() function
preTrackCallBacks.map(function(pre){pre()});
im.src=rs;
postTrackCallBacks.map(function(post){post()});
…
//outside the s.mr() function
preTrackCallBacks.push(function(){console.log("Measure")});
postTrackCallBacks.push(function(){console.log("Camp")});
Variant with custom JS events
//inside the s.mr() function
document.body.dispatchEvent(new CustomEvent(
"preCallback",
detail:{},//optional JSON of additional info
bubbles:true//optional
));
im.src=rs;
document.body.dispatchEvent(new CustomEvent(
"postCallback",
detail:{},//optional JSON of additional info
bubbles:true//optional
));
Many thanks!
http://www.albangerome.com
@albangerome
Further reading
• Overrides syntax – very succinct documentation at Adobe
https://marketing.adobe.com/resources/help/en_US/sc/implement/var_overrides.html
• s.registerPreTrackCallback() and s.registerPostTrackCallback() – very
succinct documentation at Adobe once again
https://marketing.adobe.com/resources/help/en_US/sc/appmeasurement/release/c_release_notes_mjs.html
• s_doPlugins function and DTM at Jan Exner’s excellent blog
https://webanalyticsfordevelopers.com/2015/09/01/dtm-and-the-doplugins-callback/

Contenu connexe

Tendances

Online Digital Marketing Proposal Powerpoint Presentation Slides
Online Digital Marketing Proposal Powerpoint Presentation SlidesOnline Digital Marketing Proposal Powerpoint Presentation Slides
Online Digital Marketing Proposal Powerpoint Presentation Slides
SlideTeam
 
Digital Media Consulting Proposal Powerpoint Presentation Slides
Digital Media Consulting Proposal Powerpoint Presentation SlidesDigital Media Consulting Proposal Powerpoint Presentation Slides
Digital Media Consulting Proposal Powerpoint Presentation Slides
SlideTeam
 

Tendances (20)

Expert SEO & Google Algorithm Predictions For 2023
Expert SEO & Google Algorithm Predictions For 2023Expert SEO & Google Algorithm Predictions For 2023
Expert SEO & Google Algorithm Predictions For 2023
 
ClickMinded SEM Training
ClickMinded SEM TrainingClickMinded SEM Training
ClickMinded SEM Training
 
Google Analytics for Beginners - Training
Google Analytics for Beginners - TrainingGoogle Analytics for Beginners - Training
Google Analytics for Beginners - Training
 
How to launch 'new concept' products & services in new markets | Dave Cousin ...
How to launch 'new concept' products & services in new markets | Dave Cousin ...How to launch 'new concept' products & services in new markets | Dave Cousin ...
How to launch 'new concept' products & services in new markets | Dave Cousin ...
 
Mastering GA4: How To Use The New Google Analytics Like A Pro
 Mastering GA4: How To Use The New Google Analytics Like A Pro Mastering GA4: How To Use The New Google Analytics Like A Pro
Mastering GA4: How To Use The New Google Analytics Like A Pro
 
ClickMinded SEO Mini Course
ClickMinded SEO Mini CourseClickMinded SEO Mini Course
ClickMinded SEO Mini Course
 
Facebook pixel
Facebook pixelFacebook pixel
Facebook pixel
 
Digital Marketing in the Retail Sector: What to Expect in 2022
Digital Marketing in the Retail Sector: What to Expect in 2022Digital Marketing in the Retail Sector: What to Expect in 2022
Digital Marketing in the Retail Sector: What to Expect in 2022
 
Online Digital Marketing Proposal Powerpoint Presentation Slides
Online Digital Marketing Proposal Powerpoint Presentation SlidesOnline Digital Marketing Proposal Powerpoint Presentation Slides
Online Digital Marketing Proposal Powerpoint Presentation Slides
 
Brighton SEO October 2022: How your website impacts the planet - and what yo...
Brighton SEO October 2022: How your website impacts the planet -  and what yo...Brighton SEO October 2022: How your website impacts the planet -  and what yo...
Brighton SEO October 2022: How your website impacts the planet - and what yo...
 
Digital Marketing Strategy
Digital Marketing StrategyDigital Marketing Strategy
Digital Marketing Strategy
 
Digital marketing strategy
Digital marketing strategyDigital marketing strategy
Digital marketing strategy
 
Digital campaign planning workshop
Digital campaign planning workshopDigital campaign planning workshop
Digital campaign planning workshop
 
Migrating wise.com to server-side GA4
Migrating wise.com to server-side GA4Migrating wise.com to server-side GA4
Migrating wise.com to server-side GA4
 
SEO Audit Report by Howl India for client
SEO Audit Report by Howl  India for clientSEO Audit Report by Howl  India for client
SEO Audit Report by Howl India for client
 
Digital Media Consulting Proposal Powerpoint Presentation Slides
Digital Media Consulting Proposal Powerpoint Presentation SlidesDigital Media Consulting Proposal Powerpoint Presentation Slides
Digital Media Consulting Proposal Powerpoint Presentation Slides
 
Social Media Content Strategy
Social Media Content StrategySocial Media Content Strategy
Social Media Content Strategy
 
Building the content machine
Building the content machine Building the content machine
Building the content machine
 
Data Driven Digital Marketing Strategy
Data Driven Digital Marketing Strategy Data Driven Digital Marketing Strategy
Data Driven Digital Marketing Strategy
 
Measurefest - GA4 From Migration to Measurement - The Key To Success.pptx
Measurefest - GA4 From Migration to Measurement - The Key To Success.pptxMeasurefest - GA4 From Migration to Measurement - The Key To Success.pptx
Measurefest - GA4 From Migration to Measurement - The Key To Success.pptx
 

Similaire à Adobe analytics implementation secret hacks

Compatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensionsCompatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensions
Kai Cui
 
Widget Summit 2008
Widget Summit 2008Widget Summit 2008
Widget Summit 2008
Volkan Unsal
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
維佋 唐
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
Luis Enrique
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
pbarasia
 
elm-d3 @ NYC D3.js Meetup (30 June, 2014)
elm-d3 @ NYC D3.js Meetup (30 June, 2014)elm-d3 @ NYC D3.js Meetup (30 June, 2014)
elm-d3 @ NYC D3.js Meetup (30 June, 2014)
Spiros
 

Similaire à Adobe analytics implementation secret hacks (20)

Spicy javascript: Create your first Chrome extension for web analytics QA
Spicy javascript: Create your first Chrome extension for web analytics QASpicy javascript: Create your first Chrome extension for web analytics QA
Spicy javascript: Create your first Chrome extension for web analytics QA
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project Analyzed
 
Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)
 
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
mobl
moblmobl
mobl
 
JavaScript Web Workers
JavaScript Web WorkersJavaScript Web Workers
JavaScript Web Workers
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open web
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Compatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensionsCompatibility Detector Tool of Chrome extensions
Compatibility Detector Tool of Chrome extensions
 
Widget Summit 2008
Widget Summit 2008Widget Summit 2008
Widget Summit 2008
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
elm-d3 @ NYC D3.js Meetup (30 June, 2014)
elm-d3 @ NYC D3.js Meetup (30 June, 2014)elm-d3 @ NYC D3.js Meetup (30 June, 2014)
elm-d3 @ NYC D3.js Meetup (30 June, 2014)
 
The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88
 

Plus de Alban Gérôme

Plus de Alban Gérôme (20)

Avoir de l’impact, autrement
Avoir de l’impact, autrementAvoir de l’impact, autrement
Avoir de l’impact, autrement
 
Earning more as a Digital or Web Analyst
Earning more as a Digital or Web AnalystEarning more as a Digital or Web Analyst
Earning more as a Digital or Web Analyst
 
Is it just me, or the C-suite doesn't care about data?
Is it just me, or the C-suite doesn't care about data?Is it just me, or the C-suite doesn't care about data?
Is it just me, or the C-suite doesn't care about data?
 
Cracking trading cards packs and web analytics
Cracking trading cards packs and web analyticsCracking trading cards packs and web analytics
Cracking trading cards packs and web analytics
 
The us vs the uk web analytics job slideshare
The us vs the uk web analytics job slideshareThe us vs the uk web analytics job slideshare
The us vs the uk web analytics job slideshare
 
Implementing Web Analytics on Single Page Applications
Implementing Web Analytics on Single Page ApplicationsImplementing Web Analytics on Single Page Applications
Implementing Web Analytics on Single Page Applications
 
Tagging differently
Tagging differentlyTagging differently
Tagging differently
 
Automating boring tasks with Powershell
Automating boring tasks with PowershellAutomating boring tasks with Powershell
Automating boring tasks with Powershell
 
Influence and Persuasion
Influence and PersuasionInfluence and Persuasion
Influence and Persuasion
 
Reshaping the Hype Cycle
Reshaping the Hype CycleReshaping the Hype Cycle
Reshaping the Hype Cycle
 
Claiming credit for being data-driven
Claiming credit for being data-drivenClaiming credit for being data-driven
Claiming credit for being data-driven
 
Acceptance, Accessible, Applicable et Auditable
Acceptance, Accessible, Applicable et AuditableAcceptance, Accessible, Applicable et Auditable
Acceptance, Accessible, Applicable et Auditable
 
Acceptance, Accessible, Actionable and Auditable
Acceptance, Accessible, Actionable and AuditableAcceptance, Accessible, Actionable and Auditable
Acceptance, Accessible, Actionable and Auditable
 
Logic or emotions
Logic or emotionsLogic or emotions
Logic or emotions
 
Hub and spoke model
Hub and spoke modelHub and spoke model
Hub and spoke model
 
Are you still working for a data justified company?
Are you still working for a data justified company?Are you still working for a data justified company?
Are you still working for a data justified company?
 
Persuasion
PersuasionPersuasion
Persuasion
 
Build your own analytics power tools
Build your own analytics power toolsBuild your own analytics power tools
Build your own analytics power tools
 
Is data visualisation bullshit?
Is data visualisation bullshit?Is data visualisation bullshit?
Is data visualisation bullshit?
 
Acceptance, accessible, actionable and auditable
Acceptance, accessible, actionable and auditableAcceptance, accessible, actionable and auditable
Acceptance, accessible, actionable and auditable
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Adobe analytics implementation secret hacks

  • 1. Adobe Analytics implementation secret hacks Alban Gérôme MeasureCamp London XI 23 September 2017
  • 2. The basics Pageviews tracking s.pageName="homepage"; s.channel="home"; s.prop1="home"; s.t(); Click tracking document.getElementByID("mybutton").addEventListener( "click", function(){ s.linkTrackVars="channel"; s.linkTrackEvents="None"; s.tl(true, "o", "my button was clicked"); } );
  • 3. Page views tracking gotcha s.pageName="home"; s.channel="home"; s.prop1="home"; s.t(); s.pageName="products page 1"; s.channel="products"; s.t();
  • 4. Once declared, a prop remains declared…
  • 5. … unless you reset it explicitly or load a new page. This is also true for eVars, events etc
  • 6. I am not talking about how eVars persist but about what your browser remembers
  • 7. The overrides syntax Pageviews tracking s.pageName="homepage"; s.channel="home"; s.prop1="home"; s.t(); Overrides syntax s.t({ pageName:"homepage", channel:"home", prop1:"home" }); Click tracking document.getElementByID("mybutton").addEventListener( "click", function(){ s.linkTrackVars="prop2"; s.prop2="test"; s.linkTrackEvents="None"; s.tl(true, "o", "my button was clicked"); } ); Overrides syntax document.getElementByID("mybutton").addEventListener( "click", function(){ s.linkTrackVars="channel"; s.linkTrackEvents="None"; s.tl(true, "o", "my button was clicked",{prop2:"test"}); } );
  • 8. Page views tracking revisited s.t({ pageName:"home", channel:"home", prop1:"home" }); s.t({ pageName:"products page 1", channel:"products" });
  • 9. When you use the overrides syntax Adobe Analytics keeps your props private
  • 10. Private and public data points Classic syntax = public s.pageName="homepage"; s.channel="home"; s.prop1="home"; s.t(); Your browser remembers the values of s.pageName, s.channel and s.prop1 Overrides syntax = private s.t({ pageName:"homepage", channel:"home", prop1:"home" }); Your browser sends the request and remembers nothing so you no longer need to clear your props, eVars, events etc when using virtual page views
  • 11. Your props inside the s_code act as global constants if declared in the s_doPlugins function
  • 12. s_code globals and constants • Declared inside the s_code but outside the s_doPlugins function Your props, eVars, events etc can be overridden by your page code • Declared inside the s_code, inside the s_doPlugins function Your props, eVars, events are protected and cannot be overwritten
  • 13. You can combine props in your s_code file, in your page code using the classic syntax and props using overrides
  • 14. The 3-layer onion s.t() using the overrides syntax for all props, eVars, events etc that are only relevant to the virtual page view you want to fire You can declare all props, eVars and events you share across all views displayed since the initial full page load using the classic syntax, they will ride on the same page view request as your overrides s.t() call All site-wide props, eVars and events should be declared in the s_code, outside the s_doPlugins function if you need to overwrite them on specific pages, inside if you want them protected and read-only
  • 15. The onion challenge #1 prop1 was declared: • In the s_code with s.prop1="A" outside the s_doPlugins function • In the page code with s.prop1="B" • Inside the s.t() function with s.t({prop1:"C"}); Which value gets passed to the Adobe servers? Which value does the browser remember after the s.t() call fired?
  • 16. The onion challenge #2 prop2 was declared: • In the s_code with s.prop2="A" inside the s_doPlugins function • In the page code with s.prop2="B" • Inside the s.t() function with s.t({prop2:"C"}); Which value gets passed to the Adobe servers? Which value does the browser remember after the s.t() call fired?
  • 17. Don’t get me wrong, you do need to track interactions… you just don’t need s.tl
  • 18. s.t() can fake s.tl() calls document.querySelector("button").addEventListener( "click", function(){ s.t({ lnk : true, linkTrackVars : "channel,prop1,prop2,prop3", linkTrackEvents : "None", linkName : "Button was clicked", linkType : "o", pageName : dataLayer.pageName, channel : dataLayer.channel, prop1 : dataLayer.prop1, prop2 : dataLayer.prop2, prop3 : dataLayer.prop3 }); } );
  • 19. For the full list of overrides syntax properties just look inside what s.vl_g or s.va_g contains
  • 20. Callbacks for page view tracking The s_doPlugins function executes every time you are about to track a page view with s.t() You can use that function to call a direct call rule declared in DTM for example in response to each page view or to fire a custom Javascript event It seems to work if you s.t() using the classic syntax but not the overrides syntax
  • 21. Callbacks for page view tracking AppMeasurement 1.8.0 released on 19 Jan 2017 introduced these: • s.registerPreTrackCallback() – will fire a function before the s.t() call • s.registerPostTrackCallback() – same as above but after the s.t() call • Do not call these inside the s_doPlugins function • Do not call s.t() or s.tl() inside the callback functions or you will get infinite loops and rack up infinite server calls!
  • 22. Callbacks for all tracking If you are on s_code H* and using the overrides syntax for the s.t() function, there’s still a way. It is risky and not supported by Adobe as you will need to modify code in the Do Not Modify part of the s_code It contains a function called s.mr() which stands for “make request”. It builds the entire URL for your request and sends it
  • 24. Pre and post callbacks with s.mr() var preTrackCallBacks = []; var postTrackCallBacks = []; … //inside the s.mr() function preTrackCallBacks.map(function(pre){pre()}); im.src=rs; postTrackCallBacks.map(function(post){post()}); … //outside the s.mr() function preTrackCallBacks.push(function(){console.log("Measure")}); postTrackCallBacks.push(function(){console.log("Camp")});
  • 25. Variant with custom JS events //inside the s.mr() function document.body.dispatchEvent(new CustomEvent( "preCallback", detail:{},//optional JSON of additional info bubbles:true//optional )); im.src=rs; document.body.dispatchEvent(new CustomEvent( "postCallback", detail:{},//optional JSON of additional info bubbles:true//optional ));
  • 27. Further reading • Overrides syntax – very succinct documentation at Adobe https://marketing.adobe.com/resources/help/en_US/sc/implement/var_overrides.html • s.registerPreTrackCallback() and s.registerPostTrackCallback() – very succinct documentation at Adobe once again https://marketing.adobe.com/resources/help/en_US/sc/appmeasurement/release/c_release_notes_mjs.html • s_doPlugins function and DTM at Jan Exner’s excellent blog https://webanalyticsfordevelopers.com/2015/09/01/dtm-and-the-doplugins-callback/