> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Google Tag Manager web analytics installation Canonical URL: https://posthog.com/docs/web-analytics/installation/gtm > **Cloud region:** This page uses US Cloud hosts. For an EU Cloud project, use `https://eu.i.posthog.com` instead of `https://us.i.posthog.com` (ingestion host). ## On this page - [Create a custom HTML tag](#create-a-custom-html-tag) - [Configure the trigger](#configure-the-trigger) - [Send events](#send-events) - [Next steps](#next-steps) 1. 1 ## Create a custom HTML tag Required Google Tag Manager (GTM) lets you manage tracking scripts without code changes. You can add PostHog to your site using a custom HTML tag. 1. Log into your Google Tag Manager account and open your container. 2. Click **Tags** > **New** > **Tag Configuration** > **Custom HTML**. 3. Paste the following code: Custom HTML Tag ```html ``` 2. 2 ## Configure the trigger Required 1. Under **Triggering**, select **All Pages** to load PostHog on every page. 2. Save the tag, then click **Submit** to publish your changes. Once published, PostHog will automatically capture pageviews, clicks, and other events on your site. 3. 3 ## Send events Click around and view a couple pages to generate some events. PostHog automatically captures pageviews, clicks, and other interactions for you. If you'd like, you can also manually capture custom events: JavaScript ```javascript posthog.capture('my_custom_event', { property: 'value' }) ``` 4. 4 ## Next steps Recommended After installing PostHog and ensuring [autocapture](https://posthog.com/docs/product-analytics/autocapture.md) is enabled, head to your [web analytics dashboard](https://posthog.com/docs/web-analytics/dashboard.md) to see your data. And then check out our [start here](https://posthog.com/docs/web-analytics/start-here.md) guide. > **PostHog tip:** Web analytics works with [anonymous events](https://posthog.com/docs/data/anonymous-vs-identified-events.md). This means if you are primarily using PostHog for web analytics, it can be significantly cheaper for you.