wpt.fyi icon indicating copy to clipboard operation
wpt.fyi copied to clipboard

Investigate switching to Google Tag Manager

Open jcscottiii opened this issue 3 years ago • 1 comments

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.dataLayer instead of the gtag object

No priority on this. But something to think about.

jcscottiii avatar Jul 28 '22 20:07 jcscottiii

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?

past avatar Sep 07 '22 21:09 past