GSA / data.gov

Main repository for the data.gov service
https://data.gov
Other
546 stars 87 forks source link

Swap existing gtags on data.gov and resources with GTM container #4709

Open tdlowden opened 2 months ago

tdlowden commented 2 months ago

User Story

In order to better track analytics, datagov team wants GTM implemented across the main datagov sites, for easier control and flexibility.

Acceptance Criteria

Background

GTM is already implemented on catalog.data.gov, and managing outbound linksand referrals across subdomains is easier in GTM if it is applied across all journey path subdomains

Security Considerations (required)

Limiting GTM admin access to datagov team members will ensure no extra security risk

Sketch

Image

in the <head>, add:

<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-WZJC8CX7');</script>
<!-- End Google Tag Manager -->

directly after the <body>, add:

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WZJC8CX7"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) --> 
tdlowden commented 2 months ago

Please coordinate with @tdlowden before this gets merged so we can simultaneously fire a new GA tag from GTM. Otherwise, there will be a gap in analytics collected

tdlowden commented 4 weeks ago

@robert-bryson , let's chat this week about this so we can coordinate the GTM tags with removal