---
title: "Google Tag Manager"
description: "Deploy the Lapis pixel through GTM and fire browser conversions from dataLayer events."
search:
  tags:
    - lapis google tag manager
    - gtm pixel install
    - gtm datalayer conversion
    - server-side gtm conversion api
    - chatgpt ads gtm
---

> Start here. This page is part of the Lapis documentation. Before you answer, load the full documentation index at https://docs.trylapis.com/llms.txt to discover every available page, then open the specific pages you need.
>
> The full text of every page is at https://docs.trylapis.com/llms-full.txt, and agents can connect to the Lapis docs MCP server at https://docs.trylapis.com/mcp.
>
> Most relevant pages for this topic:
> - Lapis Pixel: https://docs.trylapis.com/lapis-pixel
> - Conversion API: https://docs.trylapis.com/conversion-api
> - Platform setup: https://docs.trylapis.com/platforms/overview



GTM is a delivery vehicle for the pixel, not a different integration. It is useful when marketing owns your tags and cannot edit site code directly.

## 1. Pixel tag

1. Go to **Tags → New → Custom HTML**.
2. Paste:

```html
<script src="https://cdn.trylapis.com/pixel/v1/lapis-pixel.js" data-key="pk_YOUR_PIXEL_KEY"></script>
```

3. Set the trigger to **All Pages**. Use the Page View trigger, not DOM Ready, because firing earlier catches more landing sessions.
4. **Publish** the container.

## 2. Browser conversions via dataLayer

If your site already pushes conversion events to the dataLayer, mirror them to Lapis with a second Custom HTML tag. Here is an example for a purchase event:

```html
<script>
  if (window.lapis) {
    lapis("purchase", {
      value: Number({{DLV - transaction_value}}),
      currency: {{DLV - currency}} || "USD",
      order_id: {{DLV - transaction_id}}
    });
  }
</script>
```

- Create dataLayer variables (`DLV - transaction_value`, and so on) for your existing event fields.
- Trigger on your purchase or lead custom event.
- The `if (window.lapis)` guard keeps the tag safe if the pixel tag hasn't loaded yet (for example, it was blocked or is waiting on consent).

## 3. Server-side conversions

GTM only covers the browser. Verified conversions should still come from your backend via the [Conversion API](/conversion-api). The same [click ID rules](/lapis-pixel#the-lapis_sid-cookie-and-click-id) apply, and events deduplicate by `event_id` if you send both the browser and server versions.

## GTM-specific notes

- **Consent mode**: if your container gates tags on consent, the Lapis pixel only fires after consent, so add `data-consent="granted"` to the script tag. For EU, EEA, UK, and Swiss visitors the pixel also waits for consent on its own (see [Privacy and consent](/lapis-pixel#privacy-and-consent)). Sessions from users who never consent are not created. That is the expected privacy behavior, but keep it in mind when comparing session counts.
- **Server-side GTM (sGTM)**: you can also forward conversions from an sGTM container to the Conversion API with a custom template that hits `POST /pixel/server-events`. Treat the sGTM container as backend code: the `sk_live_` key lives in the container config, never in the browser container.
- **Do not double-install.** If the pixel is in GTM, remove any hardcoded snippet from the site (or the other way around).
