Skip to content

Commit

Permalink
docs: update Google Tag Manager page (#432)
Browse files Browse the repository at this point in the history
* docs: update Google Tag Manager page

* Update google-tag-manager.md
  • Loading branch information
benmccann authored Aug 2, 2023
1 parent 1980589 commit 5bf0915
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions docs/google-tag-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ title: Google Tag Manager
Set the script element's `type` attribute to `text/partytown`. For example:

```html
<script type="text/partytown">
/* Insert GTM Script Here */
</script>
<script type="text/partytown" src="https://www.googletagmanager.com/gtag/js?id=YOUR-ID-HERE"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'YOUR-ID-HERE');
</script>
```

## Google Analytics 4 (GA4)

When using Google Analytics, it's recommended to use [Google Analytics 4](https://support.google.com/analytics/answer/10089681?hl=en). Not only is GA4 Google's official recommendation, but it's also because the GA4 responses come with the correct CORS headers. Simply put, if you ensure you're using GA4, you will not have to [proxy](/proxying-requests) the requests to `www.google-analytics.com`.
GA4 responses come with the correct CORS headers, so you will not have to [proxy](/proxying-requests) the requests to `www.google-analytics.com`. [Older versions of Google Analytics](https://support.google.com/analytics/answer/11583528?sjid=5512098847312629397-NA) required proxying, but have been sunset by Google and are no longer supported.

## Forward Events

Expand Down

1 comment on commit 5bf0915

@vercel
Copy link

@vercel vercel bot commented on 5bf0915 Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.