# Google Analytics 4 Setup

**URL:** https://meta.discourse.org/t/google-analytics-4-setup/240029
**Category:** Data & reporting
**Tags:** analytics
**Created:** [September 25, 2022, 8:42pm UTC](https://meta.discourse.org/t/google-analytics-4-setup/240029 "2022-09-25T20:42:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![asugar](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@asugar](https://meta.discourse.org/u/asugar)
#### Post date: [September 25, 2022, 8:42pm UTC](https://meta.discourse.org/t/google-analytics-4-setup/240029/1 "2022-09-25T20:42:20Z")

</div>

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?

 ![ga](https://global.discourse-cdn.com/meta/original/4X/9/6/9/96936a5385d01f2b2c900724b3c069c6b81c3550.png)

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

```plaintext
<!-- 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 ===========

```plaintext
 <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>

```

---

<div class="post-metadata">

### Author: ![MarkDoerr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markdoerr/32/549630_2.png) [@MarkDoerr](https://meta.discourse.org/u/MarkDoerr)
#### Post date: [October 5, 2022, 4:50pm UTC](https://meta.discourse.org/t/google-analytics-4-setup/240029/5 "2022-10-05T16:50:55Z")

</div>

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
