Google Analytics 4 Setup

I added ga 4 tracking code, when I view the page source it shows a bit different code for ga than Google provides. I’ve specified both code below. Can someone confirm if I’ve set the value correctly?

============ Google gives this code ==============

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

  gtag('config', 'G-B31345EJL');
</script>

================ Discourse shows this code in page source ===========

 <meta id="data-ga-universal-analytics" data-tracking-code="G-B31345EJL" data-json="{&quot;cookieDomain&quot;:&quot;auto&quot;}" data-auto-link-domains="">

  <script async src="https://www.googletagmanager.com/gtag/js?id=G-B31345EJL"></script>
  <link rel="preload" href="/assets/google-universal-analytics-v4-c7766b0023bf99b61553444165e2540588042424b6965dda2f773b30934024ee.js" as="script">
<script defer src="/assets/google-universal-analytics-v4-c7766b0023bf99b61553444165e2540588042424b6965dda2f773b30934024ee.js"></script>

Is there any official reply to this?

1 Like

Hi Austin,

Your setup looks good to me and the page source you provided mirrors what I get on my test site when I’ve enabled GA rather than GTM. Are you seeing data flow through to your GA account?

Mark