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.
Open your GTM web container.
Go to Tags.
Create a new tag.
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>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).
Save the tag.

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.
Last updated
Was this helpful?

