Skip to content

Public-Sans: Bug: GA4 tracking code troubleshooting #337

@amycole501

Description

@amycole501

Describe the bug

No data is coming into the GA4 report. It's possible it's because there is now duplicate code on the page. We should troubleshoot until the data appears. Related to issue #322

Please let me know once the update is made and I can refresh the data in GA4 (probably wait a day or so) then check to see if it's working. If removing the code doesn't work we can continue to troubleshoot.

Steps to reproduce the bug

  1. Go to https://public-sans.digital.gov/
  2. Inspect page source
  3. Scroll to the bottom; see the google tag manager code at the very bottom
--   | <script async src="https://www.googletagmanager.com/gtag/js?id=UA-47271808-2"></script>   | <script>   | window.dataLayer = window.dataLayer \|\| [];   | function gtag(){dataLayer.push(arguments);}   | gtag('js', new Date());   |     | gtag('config', 'UA-47271808-2');

Expected Behavior

This code is the only GA4 tracking code needed on the site along with instructions:

Below is the Google tag for this account. Copy and paste it in the code of every page of your website, immediately after the element. Don’t add more than one Google tag to each page.

<script async src="https://www.googletagmanager.com/gtag/js?id=G-HBYXWFP794"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', ' gtag('config', 'G-HBYXWFP794'); </script>

Related code

No response

Screenshots

No response

System setup

No response

Additional context

No response

Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions