SlideShare a Scribd company logo
1 of 76
Download to read offline
https://www.flickr.com/photos/9422878@N08/6884612488
AB Testing, Ads & other 3rd-Party Tags
@AndyDavies · Smashing Conf · Feb ‘18
Infrastructure and code
managed by someone else
Third-party =
Guy Podjarny, Velocity Santa Clara, 2014
We’re including more and more of them
0
25
50
75
100
125
150
175
200
225
01-Jan-13 01-Jul-13 01-Jan-14 01-Jul-14 01-Jan-15 01-Jul-15 01-Jan-16 01-Jul-16 01-Jan-17 01-Jul-17 01-Jan-1
50th 75th 90th 95th HTTPArchive Jan ’13 to Jan ‘18Percentile
Well… we’ve got plenty of choice!
And we’re told they’re going to make us more money
www.flickr.com/photos/59937401@N07/5856660723
EVERYTHING SHOULD
HAVE VALUE, BECAUSE
EVERYTHING HAS A COST
Tim Kadlec
How can we measure their cost?
1. Test a page in WebPageTest
2. Repeat with selected 3rd-Parties blocked
3. Compare the two results
Requests to
be blocked
Use the filmstrip view to compare visual experience
Use the filmstrip view to compare visual experience
Feed the timings into RUM to understand the business impact
Conversions
(At least three RUM products support ‘What-If’ type analysis)
MedianPageLoadTime(s)
0
2
4
6
8
10
12
14
W
eek
0
W
eek
1
W
eek
2
W
eek
3
W
eek
5
W
eek
5
Android
iOS
3rd-Parties really can cost you money…
MedianPageLoadTime(s)
0
2
4
6
8
10
12
14
W
eek
0
W
eek
1
W
eek
2
W
eek
3
W
eek
5
W
eek
5
Android
iOSRemoved BazaarVoice
for Android visitors
3rd-Parties really can cost you money…
-4s
£+26%
Understand how 3rd-parties affect your key milestones
Working? Useful? Usable?
What’s happening here? Or here?
Analysing activity before firstMeaningfulPaint
How do we do this for many pages?
1. Grab Chrome timelines from HTTPArchive
2. Analyse with modified version of Jean-Pierre
Vincent’s 3rd-party-cpu-abuser
3. Aggregate the results
URL Count Mean (ms) SD (ms)
www.google-analytics.com 115 232 85
cdn.optimizely.com 110 440 329
pagead2.googlesyndication.com 68 375 266
assets.adobedtm.com 62 335 243
ajax.googleapis.com 59 259 114
securepubads.g.doubleclick.net 57 380 367
connect.facebook.net 47 238 89
platform.twitter.com 22 241 127
s7.addthis.com 22 360 218
tags.tiqcdn.com 20 294 137
nexus.ensighten.com 17 368 230
www.googletagmanager.com 15 317 413
apis.google.com 13 317 153
cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87
Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
URL Count Mean (ms) SD (ms)
www.google-analytics.com 115 232 85
cdn.optimizely.com 110 440 329
pagead2.googlesyndication.com 68 375 266
assets.adobedtm.com 62 335 243
ajax.googleapis.com 59 259 114
securepubads.g.doubleclick.net 57 380 367
connect.facebook.net 47 238 89
platform.twitter.com 22 241 127
s7.addthis.com 22 360 218
tags.tiqcdn.com 20 294 137
nexus.ensighten.com 17 368 230
www.googletagmanager.com 15 317 413
apis.google.com 13 317 153
cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87
Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
URL Count Mean (ms) SD (ms)
www.google-analytics.com 115 232 85
cdn.optimizely.com 110 440 329
pagead2.googlesyndication.com 68 375 266
assets.adobedtm.com 62 335 243
ajax.googleapis.com 59 259 114
securepubads.g.doubleclick.net 57 380 367
connect.facebook.net 47 238 89
platform.twitter.com 22 241 127
s7.addthis.com 22 360 218
tags.tiqcdn.com 20 294 137
nexus.ensighten.com 17 368 230
www.googletagmanager.com 15 317 413
apis.google.com 13 317 153
cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87
Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
URL Count Mean (ms) SD (ms)
www.google-analytics.com 115 232 85
cdn.optimizely.com 110 440 329
pagead2.googlesyndication.com 68 375 266
assets.adobedtm.com 62 335 243
ajax.googleapis.com 59 259 114
securepubads.g.doubleclick.net 57 380 367
connect.facebook.net 47 238 89
platform.twitter.com 22 241 127
s7.addthis.com 22 360 218
tags.tiqcdn.com 20 294 137
nexus.ensighten.com 17 368 230
www.googletagmanager.com 15 317 413
apis.google.com 13 317 153
cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87
Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
URL Count Mean (ms) SD (ms)
www.google-analytics.com 115 232 85
cdn.optimizely.com 110 440 329
pagead2.googlesyndication.com 68 375 266
assets.adobedtm.com 62 335 243
ajax.googleapis.com 59 259 114
securepubads.g.doubleclick.net 57 380 367
connect.facebook.net 47 238 89
platform.twitter.com 22 241 127
s7.addthis.com 22 360 218
tags.tiqcdn.com 20 294 137
nexus.ensighten.com 17 368 230
www.googletagmanager.com 15 317 413
apis.google.com 13 317 153
cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87
Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
URL Count Mean (ms) SD (ms)
www.google-analytics.com 115 232 85
cdn.optimizely.com 110 440 329
pagead2.googlesyndication.com 68 375 266
assets.adobedtm.com 62 335 243
ajax.googleapis.com 59 259 114
securepubads.g.doubleclick.net 57 380 367
connect.facebook.net 47 238 89
platform.twitter.com 22 241 127
s7.addthis.com 22 360 218
tags.tiqcdn.com 20 294 137
nexus.ensighten.com 17 368 230
www.googletagmanager.com 15 317 413
apis.google.com 13 317 153
cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87
Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
Let’s look at testing, using Optimizley as an example
https://www.flickr.com/photos/pinkangelbabe/427255017
Optimizely’s cost varies by implementation
0
1.25
2.5
3.75
5
Duration of script execution before firstMeaningfulPaint (ms)
0 500 1000 1500 2000 2500
Optimizely
(n=110)
Circle size = number occurrences
On the critical rendering path
Improving performance
Reducing number of
• URL Matches
• Experiments
• Plugins (Widgets)
reduces snippet size, download and execution times
Removing jQuery from the bundle and using your own (if you
already have it) can shrink bundle further
Add metrics from Optimizely to Analytics or RUM?
optimizely.get("state").getActiveExperimentIds().length
Some products have documented APIs, why not extract key
metrics and send them to analytics or RUM?
Number of experiments in snippet:
Number of experiments active for this page view:
Object.keys(optimizely.get('data').experiments).length
Use Performance APIs to build a picture
Resource Timing
• When was script requested, how long did it take to fetch, was it
cached?
User Timing
• When did the initial script execute, how long did it take?
LongTasks
• Were there any script elements that took longer that 50ms?
Make sure tests are equivalent from a performance viewpoint
Some things seen in the the wild:
• One variant redirected to a new page, the other didn’t
• Optimised vs unoptimised images
(Can be good reasons why tests can’t be equivalent)
Could you do it server-side or or at CDN level?
https://www.flickr.com/photos/kewl/8475764430
Know how to turn it off in an emergency
https://www.flickr.com/photos/chrysics/4365802409
-150ms
-300ms
£+5%
https://www.flickr.com/photos/gviciano/3128575291
What if I told you…
https://www.flickr.com/photos/gviciano/3128575291
a script loaded async, and even
injected after page load can delay a
page rendering?
…
What was the first request in this navigation?
Request #61
¯_( )_/¯
beforeUnload event
took 400ms to execute!
cloning DOM triggered
extra network requests
beforeUnload event
handlers took over
1,800ms to execute!!!
The examples aren’t isolated cases
0
3
6
9
12
15
Duration of beforeUnload event handlers (s)
0.0 0.5 1.0 1.5 2.0 2.5 3.0
Moat Ads
(n=481)
TeaLeaf
(n=271)
Not always easy to spot these delays
https://www.flickr.com/photos/fernandosanchez/2441716057
Navigation Timing API excludes beforeUnload
Prompt
for
unload
App
Cache
DNS TCP Request Response Processing onLoadRedirect
unload
navigation start
Navigation Timing API excludes beforeUnload
Prompt
for
unload
App
Cache
DNS TCP Request Response Processing onLoadRedirect
unload
Before
Unload
navigation start
Instrument addEventListener?
!(function() {
const callbacks = []
window.addEventListener = (function(_addEventListener){
_addEventListener.call(window, 'beforeunload', function(){
const args = Array.prototype.slice.call(arguments)
let total = -1 * performance.now()
callbacks.forEach(function(callback) {
callback.apply(undefined, args)
})
total += performance.now()
console.info(`total: ${total}`)
})
return function() {
if (arguments[0] === 'beforeunload') {
callbacks.push(arguments[1])
return
}
_addEventListener.apply(this, arguments)
}
})(window.addEventListener)
})() This is just a sketch of an idea - don’t deploy it without improvements!

https://gist.github.com/cvazac/de18cf4d045b01d179d8fdc2902d4997
WebPageTest?
1. WebPageTest script
navigate https://www.game.co.uk/

navigate https://www.game.co.uk/
2. Download Timeline for
step #2
3. Pipe through jq cat timeline.json | jq -r '[.[] |
select(.name=="EventDispatch"
and .args.data.type=="beforeunload")
| .dur] | add / 1000')
DevTools?
https://www.flickr.com/photos/wnieke/4078161933
Do you include adverts?
https://www.flickr.com/photos/helldini/6190516041
https://news.sky.com/story/hackers-behind-a-billion-dodgy-web-adverts-11219278
https://blog.trendmicro.com/trendlabs-security-intelligence/malvertising-campaign-abuses-googles-doubleclick-to-deliver-cryptocurrency-miners
https://discuss.httparchive.org/t/the-performance-impact-of-cryptocurrency-mining-on-the-web/1126/8
https://www.adlightning.com/ad-quality-report
“…41% of the ads tracked exceeded the industry-approved
maximum. Nearly 10% of the ads were larger than 5MB.
Some ads are as large as 30 MBs.”
“…average number of network requests and tracking scripts
per ad was 56:
3.7x greater than the maximum suggested by the IAB.”
“…one third (32%) of the ads were overly processor-
intensive.
The study also found it common for processor-intensive ads,
often video ads, to consume more than 3 seconds of CPU
time to render a single ad within the user’s browser.”
4% of video ads were in Flash format and 19% of in-banner
video ads were auto-play.
https://www.adlightning.com/ad-quality-report
And we wonder why
people use adblockers?
https://www.iab.com/newadportfolio/
Advertisers are trying to improve quality
Performance APIs can help to build a picture (within limits)
Resource Timing
• What was requested and when, how long did it take to fetch, was it
cached?
LongTasks
• Were there any script elements that took longer that 50ms?
But there are still plenty of blind spots
Can some of the security features of the web help?
Tried using
• Content-Security-Policy
• Subresource Integrity
to help a client police ads last year but didn’t have much success
TagManagers… A blessing or a curse?
https://www.flickr.com/photos/jdhancock/9004372146
Makes it really easy to add new tags
https://www.flickr.com/photos/lantzilla/29842854
Makes it easy to remove them too!
https://www.flickr.com/photos/alesimages/4215559895
Provides a shared source of truth and audit trail
https://www.flickr.com/photos/tim_ellis/3919090513
Help control loading order
https://www.flickr.com/photos/rusty_clark/32889333561
Ultimately it’s about finding the balance
https://www.flickr.com/photos/gilgamesh/183037111
VALUE
COST
EVERYTHING SHOULD
HAVE VALUE, BECAUSE
EVERYTHING HAS A COST
Tim Kadlec
Understand the COST
Establish the VALUEVALUE
COST
https://www.flickr.com/photos/basheertome/4762529213
Thanks!
@AndyDavies
www.slideshare.net/andydavies

More Related Content

What's hot

Souders WPO Web2.0Expo
Souders WPO Web2.0ExpoSouders WPO Web2.0Expo
Souders WPO Web2.0Expo
guest0b3d92d
 

What's hot (20)

Performance.now() fast but not furious
Performance.now()   fast but not furiousPerformance.now()   fast but not furious
Performance.now() fast but not furious
 
Measuring Web Performance (HighEdWeb FL Edition)
Measuring Web Performance (HighEdWeb FL Edition)Measuring Web Performance (HighEdWeb FL Edition)
Measuring Web Performance (HighEdWeb FL Edition)
 
Web Unleashed '19 - Measuring the Adoption of Web Performance Techniques
Web Unleashed '19 - Measuring the Adoption of Web Performance TechniquesWeb Unleashed '19 - Measuring the Adoption of Web Performance Techniques
Web Unleashed '19 - Measuring the Adoption of Web Performance Techniques
 
State of the resource timing api
State of the resource timing apiState of the resource timing api
State of the resource timing api
 
Progressive Web App Challenges
Progressive Web App ChallengesProgressive Web App Challenges
Progressive Web App Challenges
 
Planning Your Progressive Web App
Planning Your Progressive Web AppPlanning Your Progressive Web App
Planning Your Progressive Web App
 
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital MarketersSearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
 
SEO for Angular - BrightonSEO 2018
SEO for Angular - BrightonSEO 2018SEO for Angular - BrightonSEO 2018
SEO for Angular - BrightonSEO 2018
 
Web Performance in the Age of HTTP2 - Topconf Tallinn 2016 - Holger Bartel
Web Performance in the Age of HTTP2 - Topconf Tallinn 2016 - Holger BartelWeb Performance in the Age of HTTP2 - Topconf Tallinn 2016 - Holger Bartel
Web Performance in the Age of HTTP2 - Topconf Tallinn 2016 - Holger Bartel
 
Building an Appier Web - May 2016
Building an Appier Web - May 2016Building an Appier Web - May 2016
Building an Appier Web - May 2016
 
SearchLove Boston 2018 - Bartosz Goralewicz - JavaScript: Looking Past the ...
SearchLove Boston 2018 -  Bartosz Goralewicz -  JavaScript: Looking Past the ...SearchLove Boston 2018 -  Bartosz Goralewicz -  JavaScript: Looking Past the ...
SearchLove Boston 2018 - Bartosz Goralewicz - JavaScript: Looking Past the ...
 
Hackference
HackferenceHackference
Hackference
 
Selling Performance - Bristol WebPerf Meetup 2017-07-20
Selling Performance - Bristol WebPerf Meetup 2017-07-20Selling Performance - Bristol WebPerf Meetup 2017-07-20
Selling Performance - Bristol WebPerf Meetup 2017-07-20
 
Page Speed Insights: The Ballad of Improving Performance
Page Speed Insights: The Ballad of Improving PerformancePage Speed Insights: The Ballad of Improving Performance
Page Speed Insights: The Ballad of Improving Performance
 
Souders WPO Web2.0Expo
Souders WPO Web2.0ExpoSouders WPO Web2.0Expo
Souders WPO Web2.0Expo
 
The Case for HTTP/2 - GreeceJS - June 2016
The Case for HTTP/2 -  GreeceJS - June 2016The Case for HTTP/2 -  GreeceJS - June 2016
The Case for HTTP/2 - GreeceJS - June 2016
 
Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016
 
CSS vs. JavaScript - Trust vs. Control
CSS vs. JavaScript - Trust vs. ControlCSS vs. JavaScript - Trust vs. Control
CSS vs. JavaScript - Trust vs. Control
 
Velocity 2010: Performance Impact, Part Two: More Findings from the Front Lin...
Velocity 2010: Performance Impact, Part Two: More Findings from the Front Lin...Velocity 2010: Performance Impact, Part Two: More Findings from the Front Lin...
Velocity 2010: Performance Impact, Part Two: More Findings from the Front Lin...
 
The Case for HTTP/2 - EpicFEL Sept 2015
The Case for HTTP/2 - EpicFEL Sept 2015The Case for HTTP/2 - EpicFEL Sept 2015
The Case for HTTP/2 - EpicFEL Sept 2015
 

Similar to AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018

Http/2 - What's it all about?
Http/2  - What's it all about?Http/2  - What's it all about?
Http/2 - What's it all about?
Andy Davies
 

Similar to AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018 (20)

Top-5-java-perf-problems-jax_mainz_2024.pptx
Top-5-java-perf-problems-jax_mainz_2024.pptxTop-5-java-perf-problems-jax_mainz_2024.pptx
Top-5-java-perf-problems-jax_mainz_2024.pptx
 
MeasureWorks - Why people hate to wait for your website to load (and how to f...
MeasureWorks - Why people hate to wait for your website to load (and how to f...MeasureWorks - Why people hate to wait for your website to load (and how to f...
MeasureWorks - Why people hate to wait for your website to load (and how to f...
 
A faster journey with HTTP
A faster journey with HTTPA faster journey with HTTP
A faster journey with HTTP
 
QConPlus'21 - Beating the Speed of Light with Intelligent Request Routing
QConPlus'21 - Beating the Speed of Light with Intelligent Request RoutingQConPlus'21 - Beating the Speed of Light with Intelligent Request Routing
QConPlus'21 - Beating the Speed of Light with Intelligent Request Routing
 
Serverless orchestration and automation with Cloud Workflows
Serverless orchestration and automation with Cloud WorkflowsServerless orchestration and automation with Cloud Workflows
Serverless orchestration and automation with Cloud Workflows
 
Speed Matters!
Speed Matters!Speed Matters!
Speed Matters!
 
Front End Optimization, 'The Cloud' can help you!
Front End Optimization, 'The Cloud' can help you!Front End Optimization, 'The Cloud' can help you!
Front End Optimization, 'The Cloud' can help you!
 
WebPerformance: Why and How? – Stefan Wintermeyer
WebPerformance: Why and How? – Stefan WintermeyerWebPerformance: Why and How? – Stefan Wintermeyer
WebPerformance: Why and How? – Stefan Wintermeyer
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
 
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019 Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
 
Web Performance Optimization
Web Performance OptimizationWeb Performance Optimization
Web Performance Optimization
 
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
 
GTMetrix Report For GPStrackingMart.com
GTMetrix Report For GPStrackingMart.comGTMetrix Report For GPStrackingMart.com
GTMetrix Report For GPStrackingMart.com
 
Site Speed Fundamentals
Site Speed FundamentalsSite Speed Fundamentals
Site Speed Fundamentals
 
Bogdan Kecman INIT Presentation
Bogdan Kecman INIT PresentationBogdan Kecman INIT Presentation
Bogdan Kecman INIT Presentation
 
5 Steps to Faster Web Sites and HTML5 Games
5 Steps to Faster Web Sites and HTML5 Games5 Steps to Faster Web Sites and HTML5 Games
5 Steps to Faster Web Sites and HTML5 Games
 
Http/2 - What's it all about?
Http/2  - What's it all about?Http/2  - What's it all about?
Http/2 - What's it all about?
 
Serverless orchestration and automation with Cloud Workflows
Serverless orchestration and automation with Cloud WorkflowsServerless orchestration and automation with Cloud Workflows
Serverless orchestration and automation with Cloud Workflows
 

More from Andy Davies

Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013
Andy Davies
 

More from Andy Davies (19)

Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
 
Speed: The 'Forgotten' Conversion Factor
Speed: The 'Forgotten' Conversion FactorSpeed: The 'Forgotten' Conversion Factor
Speed: The 'Forgotten' Conversion Factor
 
Building an Appier Web - London Web Standards - Nov 2016
Building an Appier Web -  London Web Standards - Nov 2016Building an Appier Web -  London Web Standards - Nov 2016
Building an Appier Web - London Web Standards - Nov 2016
 
The Fast, The Slow and The Unconverted - Emerce Conversion 2016
The Fast, The Slow and The Unconverted -  Emerce Conversion 2016The Fast, The Slow and The Unconverted -  Emerce Conversion 2016
The Fast, The Slow and The Unconverted - Emerce Conversion 2016
 
The Case for HTTP/2 - Internetdagarna 2015 - Stockholm
The Case for HTTP/2  - Internetdagarna 2015 - StockholmThe Case for HTTP/2  - Internetdagarna 2015 - Stockholm
The Case for HTTP/2 - Internetdagarna 2015 - Stockholm
 
Making Mobile Sites Faster
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites Faster
 
Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?
 
The Case for HTTP/2
The Case for HTTP/2The Case for HTTP/2
The Case for HTTP/2
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
 
Speed is Essential for a Great Web Experience
Speed is Essential for a Great Web ExperienceSpeed is Essential for a Great Web Experience
Speed is Essential for a Great Web Experience
 
The web is too slow
The web is too slow The web is too slow
The web is too slow
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
 
What does the browser pre-loader do?
What does the browser pre-loader do?What does the browser pre-loader do?
What does the browser pre-loader do?
 
EdgeConf - Page Load Performance Opening Talk
EdgeConf - Page Load Performance Opening TalkEdgeConf - Page Load Performance Opening Talk
EdgeConf - Page Load Performance Opening Talk
 
Mobile Web Performance - Getting and Staying Fast
Mobile Web Performance -  Getting and Staying FastMobile Web Performance -  Getting and Staying Fast
Mobile Web Performance - Getting and Staying Fast
 
Making Mobile Sites Faster
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites Faster
 
Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013
 
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?
 
Are Today's Good Practices… Tomorrow's Performance Anti-Patterns
Are Today's Good Practices… Tomorrow's Performance Anti-PatternsAre Today's Good Practices… Tomorrow's Performance Anti-Patterns
Are Today's Good Practices… Tomorrow's Performance Anti-Patterns
 

Recently uploaded

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018

  • 1. https://www.flickr.com/photos/9422878@N08/6884612488 AB Testing, Ads & other 3rd-Party Tags @AndyDavies · Smashing Conf · Feb ‘18
  • 2.
  • 3.
  • 4.
  • 5. Infrastructure and code managed by someone else Third-party = Guy Podjarny, Velocity Santa Clara, 2014
  • 6. We’re including more and more of them 0 25 50 75 100 125 150 175 200 225 01-Jan-13 01-Jul-13 01-Jan-14 01-Jul-14 01-Jan-15 01-Jul-15 01-Jan-16 01-Jul-16 01-Jan-17 01-Jul-17 01-Jan-1 50th 75th 90th 95th HTTPArchive Jan ’13 to Jan ‘18Percentile
  • 7. Well… we’ve got plenty of choice!
  • 8. And we’re told they’re going to make us more money www.flickr.com/photos/59937401@N07/5856660723
  • 9. EVERYTHING SHOULD HAVE VALUE, BECAUSE EVERYTHING HAS A COST Tim Kadlec
  • 10. How can we measure their cost? 1. Test a page in WebPageTest 2. Repeat with selected 3rd-Parties blocked 3. Compare the two results
  • 12. Use the filmstrip view to compare visual experience
  • 13. Use the filmstrip view to compare visual experience
  • 14. Feed the timings into RUM to understand the business impact Conversions (At least three RUM products support ‘What-If’ type analysis)
  • 17. -4s
  • 19. Understand how 3rd-parties affect your key milestones Working? Useful? Usable? What’s happening here? Or here?
  • 20. Analysing activity before firstMeaningfulPaint
  • 21.
  • 22.
  • 23. How do we do this for many pages? 1. Grab Chrome timelines from HTTPArchive 2. Analyse with modified version of Jean-Pierre Vincent’s 3rd-party-cpu-abuser 3. Aggregate the results
  • 24. URL Count Mean (ms) SD (ms) www.google-analytics.com 115 232 85 cdn.optimizely.com 110 440 329 pagead2.googlesyndication.com 68 375 266 assets.adobedtm.com 62 335 243 ajax.googleapis.com 59 259 114 securepubads.g.doubleclick.net 57 380 367 connect.facebook.net 47 238 89 platform.twitter.com 22 241 127 s7.addthis.com 22 360 218 tags.tiqcdn.com 20 294 137 nexus.ensighten.com 17 368 230 www.googletagmanager.com 15 317 413 apis.google.com 13 317 153 cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87 Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
  • 25. URL Count Mean (ms) SD (ms) www.google-analytics.com 115 232 85 cdn.optimizely.com 110 440 329 pagead2.googlesyndication.com 68 375 266 assets.adobedtm.com 62 335 243 ajax.googleapis.com 59 259 114 securepubads.g.doubleclick.net 57 380 367 connect.facebook.net 47 238 89 platform.twitter.com 22 241 127 s7.addthis.com 22 360 218 tags.tiqcdn.com 20 294 137 nexus.ensighten.com 17 368 230 www.googletagmanager.com 15 317 413 apis.google.com 13 317 153 cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87 Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
  • 26. URL Count Mean (ms) SD (ms) www.google-analytics.com 115 232 85 cdn.optimizely.com 110 440 329 pagead2.googlesyndication.com 68 375 266 assets.adobedtm.com 62 335 243 ajax.googleapis.com 59 259 114 securepubads.g.doubleclick.net 57 380 367 connect.facebook.net 47 238 89 platform.twitter.com 22 241 127 s7.addthis.com 22 360 218 tags.tiqcdn.com 20 294 137 nexus.ensighten.com 17 368 230 www.googletagmanager.com 15 317 413 apis.google.com 13 317 153 cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87 Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
  • 27. URL Count Mean (ms) SD (ms) www.google-analytics.com 115 232 85 cdn.optimizely.com 110 440 329 pagead2.googlesyndication.com 68 375 266 assets.adobedtm.com 62 335 243 ajax.googleapis.com 59 259 114 securepubads.g.doubleclick.net 57 380 367 connect.facebook.net 47 238 89 platform.twitter.com 22 241 127 s7.addthis.com 22 360 218 tags.tiqcdn.com 20 294 137 nexus.ensighten.com 17 368 230 www.googletagmanager.com 15 317 413 apis.google.com 13 317 153 cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87 Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
  • 28. URL Count Mean (ms) SD (ms) www.google-analytics.com 115 232 85 cdn.optimizely.com 110 440 329 pagead2.googlesyndication.com 68 375 266 assets.adobedtm.com 62 335 243 ajax.googleapis.com 59 259 114 securepubads.g.doubleclick.net 57 380 367 connect.facebook.net 47 238 89 platform.twitter.com 22 241 127 s7.addthis.com 22 360 218 tags.tiqcdn.com 20 294 137 nexus.ensighten.com 17 368 230 www.googletagmanager.com 15 317 413 apis.google.com 13 317 153 cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87 Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
  • 29. URL Count Mean (ms) SD (ms) www.google-analytics.com 115 232 85 cdn.optimizely.com 110 440 329 pagead2.googlesyndication.com 68 375 266 assets.adobedtm.com 62 335 243 ajax.googleapis.com 59 259 114 securepubads.g.doubleclick.net 57 380 367 connect.facebook.net 47 238 89 platform.twitter.com 22 241 127 s7.addthis.com 22 360 218 tags.tiqcdn.com 20 294 137 nexus.ensighten.com 17 368 230 www.googletagmanager.com 15 317 413 apis.google.com 13 317 153 cdn.onesignal.com 12 270 136cdnjs.cloudflare.com 12 244 87 Top 15 CPU consumers (by frequency) - HTTPArchive rank < 5000
  • 30. Let’s look at testing, using Optimizley as an example https://www.flickr.com/photos/pinkangelbabe/427255017
  • 31. Optimizely’s cost varies by implementation 0 1.25 2.5 3.75 5 Duration of script execution before firstMeaningfulPaint (ms) 0 500 1000 1500 2000 2500 Optimizely (n=110) Circle size = number occurrences
  • 32. On the critical rendering path
  • 33. Improving performance Reducing number of • URL Matches • Experiments • Plugins (Widgets) reduces snippet size, download and execution times Removing jQuery from the bundle and using your own (if you already have it) can shrink bundle further
  • 34. Add metrics from Optimizely to Analytics or RUM? optimizely.get("state").getActiveExperimentIds().length Some products have documented APIs, why not extract key metrics and send them to analytics or RUM? Number of experiments in snippet: Number of experiments active for this page view: Object.keys(optimizely.get('data').experiments).length
  • 35. Use Performance APIs to build a picture Resource Timing • When was script requested, how long did it take to fetch, was it cached? User Timing • When did the initial script execute, how long did it take? LongTasks • Were there any script elements that took longer that 50ms?
  • 36. Make sure tests are equivalent from a performance viewpoint Some things seen in the the wild: • One variant redirected to a new page, the other didn’t • Optimised vs unoptimised images (Can be good reasons why tests can’t be equivalent)
  • 37. Could you do it server-side or or at CDN level? https://www.flickr.com/photos/kewl/8475764430
  • 38. Know how to turn it off in an emergency https://www.flickr.com/photos/chrysics/4365802409
  • 40. £+5%
  • 42. https://www.flickr.com/photos/gviciano/3128575291 a script loaded async, and even injected after page load can delay a page rendering? …
  • 43. What was the first request in this navigation?
  • 44.
  • 47. beforeUnload event took 400ms to execute! cloning DOM triggered extra network requests
  • 48. beforeUnload event handlers took over 1,800ms to execute!!!
  • 49. The examples aren’t isolated cases 0 3 6 9 12 15 Duration of beforeUnload event handlers (s) 0.0 0.5 1.0 1.5 2.0 2.5 3.0 Moat Ads (n=481) TeaLeaf (n=271)
  • 50. Not always easy to spot these delays https://www.flickr.com/photos/fernandosanchez/2441716057
  • 51. Navigation Timing API excludes beforeUnload Prompt for unload App Cache DNS TCP Request Response Processing onLoadRedirect unload navigation start
  • 52. Navigation Timing API excludes beforeUnload Prompt for unload App Cache DNS TCP Request Response Processing onLoadRedirect unload Before Unload navigation start
  • 53. Instrument addEventListener? !(function() { const callbacks = [] window.addEventListener = (function(_addEventListener){ _addEventListener.call(window, 'beforeunload', function(){ const args = Array.prototype.slice.call(arguments) let total = -1 * performance.now() callbacks.forEach(function(callback) { callback.apply(undefined, args) }) total += performance.now() console.info(`total: ${total}`) }) return function() { if (arguments[0] === 'beforeunload') { callbacks.push(arguments[1]) return } _addEventListener.apply(this, arguments) } })(window.addEventListener) })() This is just a sketch of an idea - don’t deploy it without improvements! https://gist.github.com/cvazac/de18cf4d045b01d179d8fdc2902d4997
  • 54. WebPageTest? 1. WebPageTest script navigate https://www.game.co.uk/
 navigate https://www.game.co.uk/ 2. Download Timeline for step #2 3. Pipe through jq cat timeline.json | jq -r '[.[] | select(.name=="EventDispatch" and .args.data.type=="beforeunload") | .dur] | add / 1000')
  • 57. Do you include adverts? https://www.flickr.com/photos/helldini/6190516041
  • 61. https://www.adlightning.com/ad-quality-report “…41% of the ads tracked exceeded the industry-approved maximum. Nearly 10% of the ads were larger than 5MB. Some ads are as large as 30 MBs.” “…average number of network requests and tracking scripts per ad was 56: 3.7x greater than the maximum suggested by the IAB.”
  • 62. “…one third (32%) of the ads were overly processor- intensive. The study also found it common for processor-intensive ads, often video ads, to consume more than 3 seconds of CPU time to render a single ad within the user’s browser.” 4% of video ads were in Flash format and 19% of in-banner video ads were auto-play. https://www.adlightning.com/ad-quality-report
  • 63. And we wonder why people use adblockers?
  • 65. Performance APIs can help to build a picture (within limits) Resource Timing • What was requested and when, how long did it take to fetch, was it cached? LongTasks • Were there any script elements that took longer that 50ms? But there are still plenty of blind spots
  • 66. Can some of the security features of the web help? Tried using • Content-Security-Policy • Subresource Integrity to help a client police ads last year but didn’t have much success
  • 67. TagManagers… A blessing or a curse? https://www.flickr.com/photos/jdhancock/9004372146
  • 68. Makes it really easy to add new tags https://www.flickr.com/photos/lantzilla/29842854
  • 69. Makes it easy to remove them too! https://www.flickr.com/photos/alesimages/4215559895
  • 70. Provides a shared source of truth and audit trail https://www.flickr.com/photos/tim_ellis/3919090513
  • 71. Help control loading order https://www.flickr.com/photos/rusty_clark/32889333561
  • 72. Ultimately it’s about finding the balance https://www.flickr.com/photos/gilgamesh/183037111
  • 73. VALUE COST EVERYTHING SHOULD HAVE VALUE, BECAUSE EVERYTHING HAS A COST Tim Kadlec
  • 74. Understand the COST Establish the VALUEVALUE COST