Quick answer
When someone books in a Calendly embed, Calendly tells your page with a calendly.event_scheduled message. The message holds two API addresses, one for the meeting and one for the invitee, and no name, email or answers. (+)
To get both the visit and the person who booked into PostHog:
- Capture the message as a PostHog event on your page, with the two addresses as properties.
- Create a Calendly personal access token that can read scheduled events.
- Add a PostHog destination that sends the invitee address to Calendly's API with the token, then captures a second event with the name, email and answers on the same person.
We run this on our own booking page, on Calendly's Free plan. In our test bookings the details reached PostHog about six seconds after the booking, on the person who had viewed the pages before it.
What does Calendly tell your page when someone books?
It tells your page that a booking happened and where to look it up, so you can't get the invitee's email from the Calendly embed itself. The embed runs Calendly in a frame on your page and posts messages to the page as the visitor books: profile page viewed, event type viewed, date and time selected, event scheduled, and page height. Only the event scheduled message carries booking data. (+) On our page it looked like this, with the IDs replaced:
{
event: 'calendly.event_scheduled',
payload: {
event: { uri: 'https://api.calendly.com/scheduled_events/EVENT_ID' },
invitee: { uri: 'https://api.calendly.com/scheduled_events/EVENT_ID/invitees/INVITEE_ID' }
}
}The invitee's name, email, time zone and answers to your booking questions sit behind the invitee address, in Calendly's API, and reading them needs a token. (+) A call from your page would expose that token to every visitor. The lookup therefore runs in a PostHog destination, where the token stays private.
Two limits follow from how the message works. It is sent only for bookings made in the embed on your page: someone who books through a Calendly link in an email or on calendly.com sends nothing to your site. And on our page Calendly sent it twice for each booking, so the script in Step 1 reports each booking once.
Which way of getting Calendly bookings into PostHog should you use?
For a PostHog Calendly integration that puts each booking on the visitor's person with their name, email and answers, use the page event with the API lookup this guide sets up. It works when people book through a Calendly embed on your site. If you want every booking and cancellation as rows to query in SQL, PostHog's Calendly data source does it without code. If you need them as events as they happen, use Calendly's webhook. To count the bookings made on your site, the page event alone is enough. The five ways differ in where the booking lands:
| Way | Ties the booking to the visit | Knows who booked | Catches every booking | What it takes |
|---|---|---|---|---|
| Page event only | Yes | No | No: misses bookings made outside your site, and visits where posthog-js is blocked | A few lines of JavaScript |
| Page event with an API lookup (this guide) | Yes | Yes: name, email and answers, on the person | No, for the same reasons | The JavaScript, a Calendly token and a PostHog destination |
| Calendly webhook into PostHog | Only if you pass the visitor's PostHog ID through the booking yourself | Yes | Yes, with cancellations | A subscription created through Calendly's API, pointed at a PostHog workflow's webhook trigger |
| Calendly redirect to your page with booking details | Yes | Yes, read from the page address | No, for the same reasons as the page event | A paid Calendly plan; the email lands in the page address, where every script on the page can read it |
| PostHog's Calendly data source | Only through a join in SQL, for example on an ID you pass in a UTM tag | Yes, in a warehouse table, not on the person | Yes, with cancellations, at each sync | A Calendly token |
In December 2026, Calendly's webhooks work on every plan, including Free, and redirecting with booking details needs a paid plan. (+ / +) Calendly keeps five UTM tags with each booking and accepts any value in them, such as a user ID. (+) To receive a webhook, PostHog recommends a workflow with a webhook trigger and a capture event action. (+) Its Calendly data source syncs Calendly's tables into PostHog's data warehouse, including invitees with their answers, tracking and cancellations. (+)
Step 1: Capture the booking on your page
Add this script to every page with a Calendly embed, after the PostHog snippet. It listens for Calendly's booking message and captures a calendly_booking event with the two addresses.
<script>
(() => {
const reported = new Set();
window.addEventListener('message', (e) => {
// Only Calendly's own messages, and only the booking.
if (e.origin !== 'https://calendly.com') return;
if (e.data?.event !== 'calendly.event_scheduled') return;
const invitee = e.data.payload?.invitee?.uri;
const scheduled = e.data.payload?.event?.uri;
// Calendly can send the message twice: report each booking once.
if (invitee && reported.has(invitee)) return;
if (invitee) reported.add(invitee);
window.posthog?.capture('calendly_booking', {
calendly_invitee_uri: invitee,
calendly_event_uri: scheduled,
});
});
})();
</script>- The origin check ignores messages from any frame or window other than Calendly's.
- posthog-js adds its usual properties to the event: the page, the referrer, the session and the device. That makes
calendly_bookingthe event for questions about where bookings come from. - If your site imports posthog-js from npm,
window.posthogdoesn't exist. Callposthog.capturefrom your import instead. - If a page has more than one calendar and you need to know which one was used, compare
e.sourcewith each embed'siframe.contentWindowand add a property such asplacement. Our pages do this to tell the popup from the calendar on the contact page. - You can rename the event and properties. Use the same names in Step 3's filter.
Step 2: Create a Calendly personal access token
Create the token in the Calendly account that owns the calendar:
- In Calendly, open the Profile menu, select Developer, then Personal access tokens. If Developer isn't in the menu, Calendly hasn't moved your account yet, and the tokens are on the Integrations page instead.
- Select Create personal access token, enter a name such as "PostHog booking lookup" and select Next.
- Select the
scheduled_events:readscope only. It covers reading scheduled events and their invitees. - Select Create, enter the code Calendly emails you, and copy the token. (+ / +)
The token can read every booking in the account, with names, emails and answers, and a token created by an organization admin covers everyone in the organization. (+) Keep it out of your page code and paste it only into the destination's secret input in Step 3.
In December 2026, Calendly's API works on every plan, including Free. (+) Our calendar is on the Free plan and the lookup runs there.
Step 3: Add the lookup as a PostHog destination
The destination runs on each calendly_booking event. It sends the invitee address to Calendly with your token and captures calendly_booking_details with Calendly's answer, on the same person as the booking.
- In PostHog, open Data pipelines, click + New, then Destination. Search for "Webhook" and click + Create on HTTP Webhook. (+)
- Name it, for example "Calendly booking details".
- Under Filters, choose the event
calendly_bookingand add the property filtercalendly_invitee_uriis set. - Under Edit source, click Edit source code. Each input now has a gear icon: use it to delete the template's inputs with the trash icon. Click Add input variable, enter
calendly_tokenas the Input variable name and "Calendly token" as the Display label, tick Required and Secret, and click Done. Paste the token from Step 2 into the new input. PostHog stores secret inputs encrypted and doesn't show them again. (+) - Replace the code with the code below, then click Create & enable.
// Runs for each calendly_booking event that has calendly_invitee_uri (see Filters).
let uri := toString(event.properties.calendly_invitee_uri ?? '')
// The address comes from the visitor's browser: send the token only to
// an invitee address on Calendly's API.
let invitee_path := '^https://api\\.calendly\\.com/(api/v2/)?scheduled_events/[^/]+/invitees/[^/]+$'
if (not match(uri, invitee_path)) {
print('No Calendly invitee address on this event. Skipping.')
return
}
let res := fetch(uri, {
'method': 'GET',
'headers': {'Authorization': f'Bearer {inputs.calendly_token}'}
})
if (res.status == 404) {
print('Calendly has no such invitee. Skipping.')
return
}
if (res.status >= 400) {
throw Error(f'Calendly answered {res.status}: {res.body}')
}
let invitee := res.body.resource
let personSet := {'email': invitee.email, 'name': invitee.name}
let props := {
'email': invitee.email,
'name': invitee.name,
'invitee_status': invitee.status,
'invitee_timezone': invitee.timezone,
'calendly_invitee_uri': invitee.uri,
'calendly_event_uri': invitee.event,
'answers': invitee.questions_and_answers,
'booking_event_uuid': event.uuid,
'$current_url': event.properties.$current_url
}
// Copy an answer into its own property: match a word from your question.
for (let qa in invitee.questions_and_answers ?? []) {
if (match(lower(toString(qa.question ?? '')), 'website')) {
props.website := qa.answer
personSet.website := qa.answer
}
}
// The visit's campaign tags, if the booking event carries any.
for (let key in ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term']) {
if (not empty(event.properties[key])) {
props[key] := event.properties[key]
}
}
props['$set'] := personSet
postHogCapture({
'event': 'calendly_booking_details',
'distinct_id': event.distinct_id,
'properties': props
})- The address check protects your token. The invitee address comes from the browser, and anyone can send your PostHog project a
calendly_bookingevent with an address of their choosing. The check lets through only invitee addresses on Calendly's API, with or without the/api/v2/that Calendly's embed documentation shows and our page didn't receive. - A 404 is skipped, since a made-up address on Calendly's API gets one. Other failures throw an error, so the destination's Logs show Calendly's status and reason. PostHog retries some failed requests up to three times, and disables a destination whose code keeps throwing errors over a long period. (+)
postHogCapturecan run once per destination run, which is one details event per booking. (+)$setwrites the email and name onto the person. If visitors can be logged in to your site, it replaces their account email with the one typed into Calendly. Use$set_oncethere, or a property such ascalendly_email.- The answer loop finds a question by a word in its text. If you reword the question on Calendly, check that the word still matches. All answers stay in
answerseither way. - Each booking runs the destination once. In December 2026, PostHog's free allowance includes 10,000 destination events a month. (+)
What does a booking look like in PostHog?
Each booking produces two events on one person: calendly_booking from the page and calendly_booking_details from the destination.
We made two test bookings on our own site on 1 December 2026, one from a landing page's popup and one from the contact page. The details event arrived 6.3 and 6.6 seconds after the booking event, and the destination's log shows each lookup completing in 0.29 and 0.34 seconds. Our events have other names and our destination copies a few more fields for our own reports; the setup is the one above.
calendly_booking | calendly_booking_details | |
|---|---|---|
| Captured by | posthog-js on your page | The destination |
| Carries | The two Calendly addresses, plus the page, referrer, session and device | Name, email, invitee status and time zone, all answers, the matched answer, the two addresses, the booking event's ID, the page address and any UTM tags from the booking event |
| Sets on the person | Nothing | Email, name and the matched answer |
| Use it for | Where bookings come from: pages, sources, funnels, session replays | Who booked and what they answered |
The invitee status is read once, seconds after the booking, so it says active even if the call is canceled later.
How does the booking join the visitor's person?
Through the distinct ID. The destination captures the details event with the booking event's distinct_id, so PostHog puts it on the same person as everything that ID did before booking. Its $set then adds the email and name to that person.
That reaches the earlier page views only if posthog-js keeps the same distinct ID from page to page, which needs a cookie, localStorage or sessionStorage. With persistence: 'memory', the ID lasts only for one page view. (+) On our site, visitors who haven't declined tracking get a person profile from their first page view (person_profiles: 'always') and an ID kept at least for the browser tab. Both test bookings landed on the person that already held the visit's page views, and that person now carries the booker's name, email and website. Visitors who decline tracking get memory-only persistence and a new ID on every page, so the person from their booking holds only the booking page's events.
With posthog-js's default, identified_only, an anonymous visitor has no person profile until something identifies them. We tested that case in a separate PostHog project: a page view and a booking event sent without a profile, then the details event with $set. All three events got the same person ID, and the details event created the person.
Each event keeps the person properties it had when PostHog processed it. In organizations created since June 2024, insights read those stored values, so the page views and the booking event before the details event show no email or name. Organizations that still read current values show them on the earlier events too. Filter and break down by email or answers on calendly_booking_details. To filter the whole visit by them, such as a funnel from landing page to booking, use a cohort built on the email, which follows the person's current values. Our person properties guide explains both behaviors.
Capturing the details under the email address instead would create a second person with the booker's details and none of the visit.
How do you test Calendly booking tracking in PostHog?
Book a test call on your own page. You don't need to wait for a real lead.
- Open the page in a normal browser window, with ad blockers off and tracking accepted if you use a consent banner. Book a slot with your own address. A plus address such as
you+calendly-test@yourdomain.comkeeps test bookings easy to find. Write "test" in a question. - In PostHog, open Activity and find
calendly_bookingwithcalendly_invitee_uriandcalendly_event_uri. - Open the destination's Logs. A good run completes without errors; a failed one shows Calendly's status and reason.
- A few seconds later, find
calendly_booking_detailswith your name, email and answers. Open its person: the page views from before the booking are there too. - Cancel the test booking in Calendly.
What can go wrong with the Calendly lookup?
Most problems show up at one of three points: the booking event never reaches PostHog, the destination's filter doesn't match it, or Calendly refuses the lookup.
| What you see | Likely cause | What to do |
|---|---|---|
No calendly_booking after a booking | The booking was made outside the embed, or PostHog didn't load: an ad blocker, or the visitor declined tracking | Test on your own page in a clean window. Bookings from outside your site need Calendly's webhook or PostHog's Calendly data source. |
Two calendly_booking events for one booking | The page reports Calendly's message every time it arrives | Keep the reported check from Step 1. |
| No details event and no run in the Logs | The filter doesn't match: another event name, or no calendly_invitee_uri on the event | Compare the event in Activity with the destination's Filters. |
| Logs show "Calendly answered 401" | Calendly can't authenticate the token: it is wrong, or Calendly revoked it after the account's login email, password or login method changed (+) | Create a new token and paste it into the secret input. |
| Logs show "Calendly answered 403" | The token lacks scheduled_events:read, or its user can't view this booking (+) | Create the token with that scope in the account that owns the calendar, or as an organization admin. |
| Logs show "Calendly has no such invitee" | A made-up address, or a booking removed from Calendly | Nothing, unless it happens for real bookings. |
| Logs show "No Calendly invitee address" | The event's address isn't a Calendly invitee address: an old page script, or an event someone sent by hand | Check the page script. Ignore events you didn't expect. |
| No answer property on the details event | The question's wording no longer contains the word the code matches | Update the word in the code, or read the answers list. |
invitee_status says active after a cancellation | The lookup runs once, seconds after the booking | Use Calendly's webhook or PostHog's Calendly data source if you need cancellations. |
Can you send Calendly bookings from PostHog to ad platforms?
Yes, as long as the event or its person carries what the platform matches on, such as the booker's email or the ad's click ID. calendly_booking_details carries the email and sits on the visitor's person, so PostHog's destinations for Google Ads, Meta and other ad platforms can send it as a conversion, within each platform's matching and timing rules. Google Ads, for example, refuses a conversion uploaded less than six hours after its click. Our guide to sending booked calls to ad platforms covers what each platform needs.
Frequently asked questions
Can I track Calendly bookings in PostHog on Calendly's free plan?
Yes. In December 2026, Calendly's API and webhooks work on every plan, including Free, which allows 50 API requests per user per minute. (+ / +) The lookup in this guide makes one request per booking, and our own booking calendar runs it on the Free plan. PostHog's Calendly source page still says a token needs a paid Calendly plan, and its 2023 webhook tutorial says webhooks need Professional. (+ / +) On PostHog's side, each booking uses one destination event, and in December 2026 the free allowance covers 10,000 of them a month. (+)
Does this work with a Calendly link, popup or inline embed?
It works with the popup and the inline embed, not with a link. Both embeds run Calendly in a frame on your page and send the booking message to it. Of our two test bookings, one came from a popup on a landing page and one from the inline calendar on our contact page, and both reached PostHog. A link opens Calendly's own page, which sends nothing to your site, so bookings made there need Calendly's webhook or PostHog's Calendly data source.
How do I capture UTMs on an embedded Calendly booking?
With this setup, you don't pass them to Calendly. posthog-js captures calendly_booking in the visitor's session, and PostHog keeps the session's entry UTM tags, Google click ID and channel type as session properties, such as $entry_utm_source, $entry_gclid and $channel_type. (+) Break down calendly_booking by them to see where bookings come from. Passing values into Calendly matters for its webhook and PostHog's Calendly data source, which don't see the visit. Calendly keeps five UTM tags with each booking and accepts any value in them, such as the visitor's PostHog distinct ID, which you can then join on. (+)
Can PostHog session replay record what happens inside the Calendly widget?
No. The widget is a frame served from Calendly's domain, and PostHog records a frame's content only when posthog-js runs inside it, so replays show the widget as an empty placeholder. (+) The rest of your page is recorded as usual, and the session's calendly_booking event marks when the booking happened.

