> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appreval.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics with Google Tag Manager

> Connect your GTM container and receive the checkout's events in your dataLayer, ready for GA4, Meta, TikTok or Google Ads.

Reval publishes **GA4-standard** e-commerce events into your Google Tag Manager
container's `dataLayer`. You decide, from your own GTM panel, which destinations
they go to (GA4, Meta Pixel, TikTok, Google Ads) — without touching anything in
Reval and without asking anyone for changes.

## Connecting your container

1. Copy your **Container ID** from GTM → Admin (format `GTM-XXXXXXX`).
2. In Reval: **Settings → Analytics — Google Tag Manager**, paste the ID and
   save.
3. Done: the checkout and the thank-you page load your container
   automatically. To turn it off, clear the field and save.

<Warning>
  The tags you configure in your container run inside your store's checkout. You
  are responsible for what your GTM account loads there: use a strong password
  and 2FA on Google, and grant container access only to people you trust.
</Warning>

## Available events

### `begin_checkout`

Published when the checkout loads, with the purchase the customer is about to
make:

```js theme={null}
{
  event: "begin_checkout",
  ecommerce: {
    currency: "ARS",            // your store's currency
    value: 12500.0,             // recurring total of the chosen plan
    items: [
      { item_id: "gid://shopify/ProductVariant/…", item_name: "Product A", price: 12500.0, quantity: 1 }
    ]
  }
}
```

### `purchase`

Published on the thank-you page once the subscription was created and the
charge approved. **It's emitted exactly once per purchase**: reloading the
thank-you page doesn't duplicate it.

```js theme={null}
{
  event: "purchase",
  ecommerce: {
    transaction_id: "…",        // stable id of the subscription
    value: 13500.0,             // total charged (products + shipping)
    tax: 1000.0,                // reported tax portion, 0 when not applicable
    shipping: 0.0,
    currency: "ARS",
    items: [                    // includes one-time add-ons, if there were any
      { item_id: "gid://shopify/ProductVariant/…", item_name: "Product A", price: 12500.0, quantity: 1 }
    ]
  }
}
```

<Note>
  Before each event, `{ ecommerce: null }` is published, following GA4's
  convention for clearing the previous object.
</Note>

## Verifying it

1. In GTM, open **Preview** (Tag Assistant) and navigate to your store's
   checkout: you should see the container loaded and `begin_checkout` on the
   timeline.
2. Complete a test purchase: `purchase` appears on the thank-you page with the
   transaction detail.
3. Reload the thank-you page: `purchase` does **not** appear again.

## What to do with the events

In your container, create one tag per destination using these events as
triggers. The names and structure follow GA4's e-commerce schema, so the
**GA4** tag understands them with no manual mapping, and for
**Meta/TikTok/Ads** you map `value`, `currency` and `items` to the
destination's fields from dataLayer variables.
