Home › How-tos › The Secret Setups › Calendly
How to track Calendly bookings in the dataLayer
Live guide · Checked 28 October 2026 · Updated 28 October 2026 · Checked every week against Calendly's own help pages
Listen for Calendly's booking message from the embedded calendar and push it into the dataLayer as a lead, so every platform counts booked calls.
- Time
- 15 minutes
- You will need
- A Calendly calendar embedded on your site (inline, popup or widget)
- Google Tag Manager with the generate_lead trigger
- Stuck?
- Troubleshooting or ask us a question
Step by step
Check it's an embed
This works for Calendly's inline, popup widget and popup text embeds on your own pages. A plain link that opens calendly.com in a new tab can't be tracked from your site.
Add the listener
Calendly tells the page about bookings with a browser message. In Tag Manager add a Custom HTML tag on All Pages (or only pages with the calendar):
<script> (function () { function isCalendly(e) { return e.origin === 'https://calendly.com' && e.data && typeof e.data.event === 'string' && e.data.event.indexOf('calendly.') === 0; } window.addEventListener('message', function (e) { if (!isCalendly(e)) return; window.dataLayer = window.dataLayer || []; if (e.data.event === 'calendly.date_and_time_selected') { window.dataLayer.push({ event: 'calendly_time_picked' }); } if (e.data.event === 'calendly.event_scheduled') { window.dataLayer.push({ event: 'generate_lead', form_id: 'calendly', lead_type: 'booking', value: 100, currency: 'GBP', lead_id: 'L-' + Date.now() }); } }); })(); </script>Keep the booking link (optional)
The booked message includes links to the booking. To keep the event's link, add this inside the
event_scheduledpush:calendly_event: (e.data.payload && e.data.payload.event && e.data.payload.event.uri) || ''It's a link to the booking in Calendly, not the person's details.
Test a booking
In Preview, book a test slot through the embed. Tag Assistant should show
generate_leadwithlead_typebooking. Cancel the test booking in Calendly after.Publish
Publish. Your GA4, Google Ads and Meta lead tags now count bookings. Use
lead_typein GA4 to see them on their own.
Tips from people who set these up every week
- Bookings are usually worth more than form fills: give them a higher value.
- Calendly's own Google Analytics setting tracks inside Calendly; this listener gives you control and works with every platform.
Troubleshooting: questions and answers
Nothing fires after a booking.
Check the origin: on some accounts messages come from a regional Calendly domain. Open the browser console, run addEventListener('message', e => console.log(e.origin, e.data)), book a slot and see the origin.
Official help pages
Let Claude fix the rest of your funnel
Lead Focus is 12 Claude Skills that find the stage of your funnel that's costing you leads, then fix it: ads, landing pages, follow-ups and tracking. One payment, 12 months of updates, and a 14-day refund.
Get Lead Focus · $29.99Still stuck, or have a question?
Tell us where you got to and what you see. We read every message and reply by email, usually the same working day.