> For the complete documentation index, see [llms.txt](https://docs.chathq.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chathq.io/api-and-developer-docs/custom-tracking-and-analytics/widget-events-in-google-analytics/1.-google-analytics-and-google-tag-manager.md).

# 1. Google Analytics & Google Tag Manager

## Configure GA4 and GTM

You will need to set up GA4 and GTM for the specific website hosting the ChatHQ Engagement Widget you're looking to track with analytics

* **Setting Up GA4 -** <https://support.google.com/analytics/answer/9744165>
* **Setting Up GTM -** <https://support.google.com/tagmanager/answer/6103696>

## Setup GA4 Inside GTM

<figure><img src="/files/H3ZjDtA0ZRpoj01xmknC" alt=""><figcaption></figcaption></figure>

Use GTM to host your GA4 data stream code so that all GA4 data runs through GTM into your GA4 analytics dashboard - <https://support.google.com/tagmanager/answer/9442095>
