> For the complete documentation index, see [llms.txt](https://docs.adpage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adpage.io/faq/google-tag-manager-setup/how-do-i-track-a-calendly-appointment.md).

# How do I track a Calendly appointment?

Follow the steps below to track meetings scheduled through a Calendly embed on your website as a GA4 event.

### Custom HTML listener script

To track Calendly with Google Tag Manager, you need to create a Custom HTML tag in your GTM container.

1. Open your GTM web container.
2. Go to Tags.
3. Create a new tag.
4. Choose Custom HTML as the tag configuration and paste the following code:

```
<script>
window.dataLayer = window.dataLayer ||[];
window.addEventListener('message',
  function(e) {
    if (e.data.event && e.data.event.indexOf('calendly') === 0) {
      window.dataLayer.push({
        'event' : 'calendly',
        'calendly_event' : e.data.event.split('.')[1]
      });
    }
  }
);
</script>
```

5. Give this tag the All Pages trigger (or, if you only have a Calendly embed on one specific page, use that page as the trigger).
6. Save the tag.

<figure><img src="https://2963651437-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5eC7lwaeygB0xx6AOZcE%2Fuploads%2F41rocxa0AH1IbfncSu5q%2Fimage.png?alt=media&amp;token=0ac099ea-6e6a-406e-84fc-3f75f959d34b" alt=""><figcaption></figcaption></figure>

### Using the dataLayer event push

This Custom HTML code is a listener that looks for Calendly events on a page and makes them available in the dataLayer. It will push one of the following four events:

* profile\_page\_viewed - when the profile page was viewed
* event\_type\_viewed - when the event type page was viewed
* date\_and\_time\_selected - when the visitor selected a date and time
* event\_scheduled - when the visitor successfully booked a meeting

To use these in GTM, start by creating a DataLayer Variable with calendly\_event as the Data Layer Variable Name. This variable gives you access to the specific Calendly action that took place.

Next, create a Custom Event trigger with calendly as the event name. Set it to fire on Some Custom Events, with the condition that your calendly\_event variable equals the action you want to track. For a booked meeting, that's event\_scheduled. If you'd like to track other steps in the booking flow, you can create additional triggers using the other values, or use a single trigger with a condition like matches RegEx to capture several at once.

Finally, attach the trigger to a Google Analytics: GA4 Event tag with your GA4 Measurement ID (or the constant variable that holds it). You're free to choose the event name, for example sign\_up, generate\_lead, contact or appointment\_scheduled. If you want to send the Calendly action along as an event parameter, add a parameter to the tag and use the calendly\_event variable as its value.

Use GTM Preview mode to check that your tag fires when you schedule a meeting through the Calendly embed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.adpage.io/faq/google-tag-manager-setup/how-do-i-track-a-calendly-appointment.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
