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

# Google Tag Manager (GTM) Integration with lunacal.ai

> Lunacal allows you to track user interactions and bookings using Google Tag Manager (GTM).

## **1. Understanding GTM Container ID in Lunacal**

A GTM Container ID looks like:`GTM-XXXXXXXX`

lunacal requires this ID to load your GTM container and trigger your tags.\
You can set this ID at multiple levels depending on your tracking needs:

### **(A) Account-level (User Profile)**

* This is the **default container** for your personal events.
* It loads on all booking pages unless overridden by a specific container set for your Event Types.

### **(B) Team-level**

* Each team can have its **own GTM Container ID**.
* When added here, It loads on all team events, it didn't **overrides the account-level ID**.

### Installing GTM

* Go-to: **Integrations** > [Analytics](https://app.lunacal.ai/apps?tab=apps\&category=analytics)
* Find **Google Tag Manager (GTM)**.
* Click **Connect**.

![Step 1](https://lunacalwebsite.blob.core.windows.net/website-assets/HelpDocs/1.webp)

## Step 2: Choose Installation Scope

When you click **Connect**, you will see:

**Option A – Connect GTM for your Account**

* This makes GTM available for all event types in your workspace.

**Option B – Connect GTM for a specific Team**

* Choose this if you only want GTM for selected teams. Select your preferred option and continue.

![Step2](https://lunacalwebsite.blob.core.windows.net/website-assets/HelpDocs/2.webp)

## Step 3: Enter Your GTM Container ID

* After selecting **Account** or **Team**, you will see an input box.
* Enter your GTM container ID (example: GTM-XXXXX123).
* Click **Save**.

![step3](https://lunacalwebsite.blob.core.windows.net/website-assets/HelpDocs/3.webp)

GTM is now installed.

`The GTM ID you enter here becomes the default ID shown inside event types (when you enable GTM for them).`

## 2.  Enabling GTM for Individual Event Types

Installing GTM does **not automatically enable it** for all event types.\
You must activate GTM for each event type you want to track.

* Go to [Event Types](https://app.lunacal.ai/event-types)
* Click the gear ⚙️ icon.
* Click **Edit**.

![step4](https://lunacalwebsite.blob.core.windows.net/website-assets/HelpDocs/4.webp)

* Go to **Integrations** Section.
* You will see a GTM toggle in **off** state.
* To Enable GTM Turn **ON** the GTM toggle

![step 5](https://lunacalwebsite.blob.core.windows.net/website-assets/HelpDocs/5.webp)

`You will see the same GTM ID you entered during installation (auto-filled)`

Click **SAVE**

That's it — GTM is now active for this event type.

You can repeat these same steps for your team events.

## 3.  Datalayer Events Triggered by Lunacal

When GTM is enabled for an event type, lunacal automatically fires these datalayer events on booking interactions:

| **Event Name**        | **Fires When…**                               | **Suggested GTM Trigger Category** |
| :-------------------- | :-------------------------------------------- | :--------------------------------- |
| `navigatedToCalendar` | User lands on the calendar view               | Custom Event                       |
| `navigatedToTeam`     | User views team booking options               | Custom Event                       |
| `navigatedToUser`     | User views a specific user/host profile       | Custom Event                       |
| `eventSelected`       | User clicks to select a specific event type   | Custom Event                       |
| `memberSelected`      | In a team booking, user selects a team member | Custom Event                       |

| **Event Name**                   | **Fires When…**                                          | **Example GTM Use Case**      |
| :------------------------------- | :------------------------------------------------------- | :---------------------------- |
| `timeSlotSelected`               | User clicks an available time slot                       | Funnel step in GA4            |
| `bookingRequested`               | User submits booking request (before final confirmation) | Track partial conversions     |
| `bookingFailed`                  | Booking fails due to conflict/validation                 | Conversion abort tracking     |
| `paymentSuccessfull`             | User completes payment (if booking is paid)              | Purchase conversion           |
| `couponApplied`                  | Coupon/discount code successfully applied                | Promo effectiveness analytics |
| `bookingSuccessfull`             | Booking fully completed (alternate or older naming)      | Conversion tracking           |
| `bookingSuccessfullV2`           | Updated booking success event (improved schema)          | Use for enriched payload      |
| `rescheduleBookingSuccessfull`   | Booking was rescheduled successfully                     | Conversion path analysis      |
| `rescheduleBookingSuccessfullV2` | New version of reschedule success event                  | New schema tracking           |
