-1

If javascripts from Google Analytics, Google Tag Manager and/or other javascripts doing a kind of web analytics, are implemented with a HTTP/2 push - does it, and if yes, how, manipulate/falsify the measuring results?

Evgeniy
  • 2,337
  • 2
  • 28
  • 68

1 Answers1

1

Shouldn’t have any effect.

Push is about delivering assets (e.g. javascript files) to the web browser before they are asked for. Google Analytics (GA) and Google Tag Manager (GTM) only do stuff when the scripts are executed - so getting the GA file for example via push, pull, or loaded from cache doesn’t matter until that file is run and it registers a hit, or loads the tags that register the hits.

In fact, at a technical level, HTTP/2 push doesn’t even push any files directly to the page, but pushes it to a push cache, and which the browser checks first before requesting a file.

So the only change should be that, if you have set up HTTP/2 push correctly, then the browsers that support that might be able to execute them fractionally earlier as the pushed file should hopefully already be downloaded when it’s needed. This might, for example, register more a accurate start time on the page (though to be honest it shouldn’t be massively different for the level of accuracy that these tools give). However, on the flip side, if you are currently inlining the GA code and change this to an external (pushed) js file then you might lose a tiny bit of time as there are still some overheads to processing a separate file, even if it is pushed to arrive before it’s needed. But again this time used shouldn’t really be noticed.

Saying that you need to be careful with push and shouldn’t waste users bandwidth pushing assets they already have (e.g. if you push the GA js file with every request even though it’s cached). Won’t affect the accuracy it’s just a waste of bandwidth.

Thanks, Barry

Barry Pollard
  • 40,655
  • 7
  • 76
  • 92
  • Could you point me further on the topic of http/2 push and cache. There are two articles with opposite meaning. This one, https://stackoverflow.com/questions/29352282/does-the-browser-cancel-server-push-when-a-resource-is-in-cache, means - client cancels push, if ressource is cached. This one, https://css-tricks.com/cache-aware-server-push/, means - not. – Evgeniy Jan 10 '18 at 16:21
  • 1
    Client should cancel push requests if not needed. However this is not as efficient as not requesting it if not needed. By the time the cancellation message is sent, the asset might have been delivered and is thrown away. This link is probably the best resource on some of the technical details on HTTP/2 push: https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/. Or buy my book as linked in my Stack Overflow profile (though I’ve not written that chapter yet!). – Barry Pollard Jan 10 '18 at 16:39