wpt.fyi
wpt.fyi copied to clipboard
Investigate switching to Google Tag Manager
Switching to Google Tag Manager has some pros and cons when using Google Analytics
Pros:
- Tag Manager can determine where to send the event measurements in the backend. Therefore, we don't need to do
if host == prod; use Prod GA ID; else use Staging ID - Has a console that allows you to test the changes and debug them
Cons:
- The injection of events is different. You have to push them through this global
window.dataLayerinstead of thegtagobject
No priority on this. But something to think about.
We should check if there is a difference in whether other browsers block the analytics script between the two options. I remember Firefox blocking GTM in some configurations (maybe by default now), perhaps Safari too?