podaac / hitide-ui

Apache License 2.0
2 stars 1 forks source link

hitide-ui: Add Google Tag Manager to track Google Analytics #60

Closed jamesfwood closed 5 months ago

jamesfwood commented 8 months ago

FYI: the ESDIS analytics team provided the Google tag manager code for inclusion to all of our web interfaces: Place in the section of the page:

           <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start’:
           new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
           j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
           'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
           })(window,document,'script','dataLayer','GTM-WNP7MLF');</script>

Place right after the opening tag

           <noscript><iframe src=https://www.googletagmanager.com/ns.html?id=GTM-WNP7MLF
           height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

in addition:

please NOTE: if we want to track events on the page (i.e. user clicks on the page) we would need to define custom Event tracking tag in the GA system. We can/will ask ESDIS Metrics team to provide training to us on how to create custom tags.

jamesfwood commented 8 months ago

@jbyrne6 work with Sandra Cosic on this to know exactly what to do. I believe it needs to be different for UAT and OPS.