---
title: "Google Tag Manager | Installation | Documentation - Vemetric"
description: "Easily integrate Vemetric using Google Tag Manager."
url: https://vemetric.com/docs/installation/google-tag-manager
---

# Integrate Vemetric using Google Tag Manager

Easily integrate Vemetric using Google Tag Manager.

* * *

Google Tag Manager is a popular tool for managing and deploying other scripts into you website.

Below you can find a step by step guide on how to integrate Vemetric using Google Tag Manager.

## Installation

### Create a new tag

Create a new tag in your Google Tag Manager container and select `Custom HTML` as the tag type.

![Screenshot of specifying the tag type in Google Tag Manager](https://vemetric.com/_astro/gtm-1.D_EHsLb__ZCoGqd.webp)

### Add the code snippet

Paste the following code snippet into the `HTML` input field:

```html
<script>
  window.vmtrcq = window.vmtrcq || [];
  window.vmtrc = window.vmtrc || function (){window.vmtrcq.push(Array.prototype.slice.call(arguments))};

  var script = document.createElement('script');
  script.src = "https://cdn.vemetric.com/main.js";
  script.defer = true;
  script.id = 'vmtrc-scr';
  script.dataset.token = 'YOUR_PROJECT_TOKEN';
  document.getElementsByTagName('head')[0].appendChild(script);
</script>
```

> Replace `YOUR_PROJECT_TOKEN` with the unique token for your project (found in the project settings).

### Configure triggering

Configure the tag to fire on `All Pages`.

![Screenshot of specifying the tag trigger in Google Tag Manager](https://vemetric.com/_astro/gtm-2.BuQDSrCn_Z19cas4.webp)

### Verify installation

After saving and publishing your container in Google Tag Manager, Vemetric will automatically start tracking page views on your site (each page load will be recorded). You can verify this by checking your Vemetric dashboard for incoming pageview events a few seconds after loading a page

> Data from `localhost` won’t be tracked.

Keep in mind that one project can be used to track data from multiple websites, which can be useful when you for example want to track users across your landing page and web application. We’ve also created a guide on [how to track data across subdomains](https://vemetric.com/docs/advanced-guides/track-across-subdomains).

### Optional: Track custom events and identify logged-in users

You can either track custom events via data attributes on elements, or by interacting with the `vemetric` object on the `window`.

**Data Attributes**

You can track custom events by adding `data-vmtrc` attributes to any HTML element.

```html
<button data-vmtrc="MyCustomEvent">Click me</button>
```

Look at the [data attributes docs](https://vemetric.com/docs/product-analytics/tracking-custom-events#data-attributes) for more information.

**JavaScript API**

You can also track custom events and identify users by calling the `trackEvent` function on the `vemetric` object available on the `window`.

```ts
await window.vmtrc('trackEvent', 'MyCustomEvent', {
  eventData: { key: 'value' },
}
```

Look at the [HTML Script docs](https://vemetric.com/docs/sdks/html-script#trackevent) for a detailed explanation of the available parameters.

Also learn more about [User Identification](https://vemetric.com/docs/product-analytics/user-identification) to track authenticated users and see their [full journey](https://vemetric.com/docs/product-analytics/user-journeys).
