Why I Replaced a 4 MB Calendly Embed With My Own Booking Flow

A Calendly embed takes one line of code, so it looks free. When I rebuilt the Book a Demo page as part of the redesign of Zipher, a B2B client of mine, I started with Calendly’s inline widget.

It wasn’t free. It brought about 51 requests and 4.2 MB with it, and the panel changed height at every step.

Real visitors never saw that embed. I ran it on the redesign’s own builds for about a day in October. The old live page just had a request form, no calendar at all.

So I built my own three-step panel with help from Claude Code and used it to replace the embed. Pick a day, pick a time, fill in your details. Calendly still does the work behind the scenes through its API: it supplies the open slots, creates the booking and sends the confirmation email.

Status: live on zipher.ai since the site’s redesign launched on 24 November 2026. I measured the embed and the panel in the lab in October, using the redesign’s local build and its staging app. The production section is from 30 November.

Real bookings go all the way through on the live site.

Live booking panel on zipher.ai showing time slots

The booking panel live on zipher.ai at 1440 px, on the time step, 30 November 2026.

What the Calendly embed really cost

I measured the page with the embed on 13 October 2026 using the local build. I used a Playwright script for three runs and took the median for transferred bytes. The local build didn’t have the site’s own trackers, so every third-party request on the page came from the embed.

What loaded Requests Transferred
The whole page 78 4,555 KB
The site’s own files 27 328 KB
Calendly’s own domain 16 2,853 KB
15 other third-party hosts loaded by the iframe 35 1,374 KB

My first estimate came to 2.9 MB because I counted only calendly.com. The other 15 hosts belong to Calendly, not Zipher: Stripe, reCAPTCHA, a Facebook pixel, Google sign-in, Segment, Braze and a few more.

Calendly inline embed with a month calendar

The Calendly inline embed on step 1, in the local build at 1440 px, 13 October 2026.

A panel that kept changing height

The widget changes height at every step. At 1440 px, I measured 748.8 px on the calendar, 913.8 px on the times and 1,253.8 px on the details form. At 390 px, it went from 698 to 863 to 1,297 px.

With every click, a visitor would have seen the page grow or shrink. I covered the same problem with embedded YouTube videos, but I couldn’t swap a booking widget for a thumbnail.

Three smaller problems

  • A second cookie banner. At the panel’s width, Calendly’s own banner inside the iframe covered the whole calendar. I fixed that with a URL parameter, hide_gdpr_banner=1.
  • Colours only. The design called for a fixed-size panel. The embed takes colour parameters, but it couldn’t stay within the dimensions in the design. It overflowed by 20 px at a 320 px viewport.
  • The lead form. Zipher’s demo leads go into HubSpot through the “Request a Demo” form. A Calendly booking doesn’t submit that form, so I had to make the new flow submit it from the server. Calendly’s own HubSpot integration is connected now too; how its records and the form submission combine in HubSpot is not something I have checked.

Why a server proxy

Before I designed anything, I wrote down the cheaper options. I had three goals: keep the site’s own design, keep the page light and get the lead into HubSpot.

Option Why it lost
Keep the embed, add a webhook for HubSpot Fixes neither the weight nor the design
Our own day and time picker, then Calendly’s hosted form The visitor leaves the site, and the lead never reaches the “Request a Demo” form
Call Calendly’s API from the browser The API token would be public
Our own panel plus a server proxy (chosen) The only one that meets all three goals

How the new booking flow works

The browser never talks to Calendly directly. I gave it two routes on the site’s WordPress REST API instead. The server talks to Calendly using a token that never reaches the page.

  • A slots route. One GET with no parameters brings back every open slot for about 60 days ahead. That’s up to 31 slots a day, 30 minutes apart, and about 3 KB gzipped for 60 days.
  • A booking route. One POST checks the input, books with Calendly and sends the lead to HubSpot.

Public routes need their own defences. For this one, I added an origin check, a signed time-trap token, a honeypot, rate limits and a site-wide cap.

I kept the limits and cap low. I cover the basics in my guide to securing the WordPress REST API.

Browser (booking.js, vanilla, deferred)
   GET  /wp-json/zipher/v1/booking/slots   (no params, no-store)
   POST /wp-json/zipher/v1/booking         (JSON, same-origin, signed token)
        |
WordPress (server-side proxy; the Calendly token stays here)
   slot cache: under 60 s serve; 60 s to 15 min serve, then refresh after the response
   WP-Cron every 5 min: warm the slot list, re-read the event settings
   Calendly:  GET /event_types/{uuid}, GET /event_type_available_times (x9),
              POST /invitees, GET /scheduled_events?invitee_email=..., GET /users/me
   HubSpot:   the existing "Request a Demo" form, 4 s timeout, retried by cron

The Calendly API calls behind it

I use four endpoints to do the work, and I call GET /users/me once a day for the organization. I checked Calendly’s API reference on 30 November 2026. Here’s what it lists for each endpoint’s scopes.

Call Why Scope
GET /event_types/{uuid} Is the event active, what location kind, which questions event_types:read
GET /event_type_available_times The open slots event_types:read
POST /invitees Create the booking scheduled_events:write
GET /scheduled_events Did this person already book this slot? scheduled_events:read

My first booking call failed twice before it went through. The call needs a location that matches the event’s own kind, plus a tracking object with all six keys, even when their values are null. My first token was also missing scheduled_events:write.

Before you build, check your plan’s rate limits. As of 30 November 2026, Calendly’s rate-limit page lists 500 requests per user per minute on paid plans.

Creating bookings has a separate limit: 5 requests per user per day on the Free and Trial plans, and 10 a minute, 50 an hour and 100 a day on paid plans below Enterprise.

There’s one limit I can’t confirm. My code asks for slots in nine seven-day windows because I hit a seven-day limit in an early test. Calendly’s reference now says a request can span up to 31 days.

I haven’t tested that on this event. If it holds, I could cut nine calls down to two.

A cached page cannot know anything

The page’s HTML sits in a server cache for days. On 13 October I found a cached copy of the production page that was 7.8 days old.

So I can’t put anything specific to a visitor in that HTML. No WordPress nonce, not even an answer to “is the flow on?”

Instead, I always include a plain “Pick a time on Calendly” link in the markup. The script hides it when the slots arrive. If the script never runs, a CSS-only rule shows the link after six seconds.

That doubles as a kill switch. If I remove one constant from the server’s config, the slots route returns 503 and the page falls back to the link. No cache purge needed.

Booking panel fallback with a link to Calendly

The fallback, from a local test run: if the slots never arrive, the panel shows a link to the regular Calendly page.

One fixed size, no scrolling inside it

One constraint shaped everything: I had to keep the panel the same size through every step and every state. I took the dimensions from the Figma frame: 535 × 546 px from 768 px up and 350 × 476 px on mobile.

On mobile, the content box is 368 px tall, and every step uses all of it. For step three, the details form, the design spec gets that height by adding up the 44 px top bar, four rows of fields, one message line and the 48 px button, plus the gaps between them.

44 + 12 + 220 (4 × 46 + 3 × 12) + 12 + 20 + 12 + 48 = 368

“Mobile has no slack in any step. Nothing may be added to a step without taking something out.”

From the project’s design spec, 13 October 2026.

Once I did that sum, most of the interaction design followed.

  • Pick a day or a time and the panel moves on right away. A Next button costs 48 px.
  • The top bar does two jobs: it takes you back and shows what you picked.
  • Times come in pages of five rows. A day can have up to 31 slots, and a scrolling list was out of bounds.
  • You can see the time zone, but you can’t change it. A picker with hundreds of zones won’t fit in a fixed box.
  • I set aside one line for all messages. Putting messages under each field would change the height.
Every booking panel state at mobile width

Every state of the panel at 390 px, from a local test run with sample data, including loading, just taken, booking failed, unconfirmed and the fallback link. Each one is 350 × 476.

Prove the fit before writing production code

The risky part was saying it would all fit, so I tested that first. I used a static prototype with fake data and measured 23 states at seven widths from 320 to 1440 px.

I found five problems on the first run. Day cells were too narrow at 360 px, and the time labels got cut off.

Then there was the long zone name that pushed the pager out of the box. At 320 px, the title wrapped and made every panel 504 px tall. And axe flagged accessibility errors.

Once I could see what was going wrong, each fix was small. On the final run, all 23 states held at 546 px from 768 up and 476 px below.

The first version was barely faster

With the first build, a visitor could click a day after 6.6 s on the local site at 1440 px. The embed had taken 8.3 s when I measured it just before I removed it. Better, but not what the weight numbers had led me to expect.

My cache was the problem. The slot list stayed fresh for 60 seconds, and then the next visitor had to wait for a refetch.

Calendly’s availability call took 2.0–2.3 s for one day and 2.3–3.8 s for seven. Running nine in parallel took 3.0 s.

The route took 6.2–6.5 s with a stale list and 1.2–1.3 s with a warm one. On a quiet page, nearly every visitor gets the stale list.

I fixed it by serving a slightly stale list and refreshing it after the response.

Age of the stored list What the visitor gets
Under 60 seconds The stored list
60 seconds to 15 minutes The stored list at once, refreshed after the response
Over 15 minutes, or none A fresh fetch, one at a time

After the fix, a five-minute-old list took 1.4–2.2 s to respond on the local build. A cron job also refreshes the list every five minutes, so visitors rarely hit a cold list. Later, on staging, a cold fetch took 8.7 s.

On production, the refreshes I saw from outside on 30 November (08:55, 09:00 and 09:10 UTC, between my own requests) fit a five-minute warmer.

The trade-off is freshness. A slot someone took minutes ago can still show up. If you pick it, you get “Just taken – pick another time”.

Booking panel with a just-taken slot message

A slot that was just taken, from a local test run: the panel says so and keeps the visitor on the time step.

What the reviews caught

Before I wrote any code, I asked a second AI agent to poke holes in my server design. Three things it caught matter beyond this project.

  • A retry could have booked twice. If the first attempt times out, the retry can say “slot taken” even though the booking is the visitor’s own. Now the server checks for an existing booking first. If it still can’t tell, it says “could not confirm – check your inbox”.
  • A honeypot that lied. Mine pretended the booking had gone through. But browser autofill can fill a hidden field, so a fake “booked” message would lie to a real person.
  • My tests could have called the real API. The agent’s reading of WordPress core was that Requests::request_multiple(), which I used for the nine parallel calls, skips WordPress’s pre_http_request filter. My test mocks rely on that filter, so the client now applies it itself.

I found one more trap in my own measurements. Chromium reports old zone names like Asia/Calcutta, but PHP’s list of zones doesn’t include them. If I’d validated against that list, I’d have turned away visitors from India.

Once every test was green, I asked a fresh reviewer agent to read the whole diff. It came back with 2 critical findings and 9 important ones.

A lead could vanish without a trace if HubSpot refused it. I also hadn’t checked the requested time against the slot list, so a script could make unlimited Calendly calls.

I’d also left the back control active while the booking request was in progress. Picking a second time before it finished meant two bookings.

I fixed all of them and wrote tests first for the two critical ones. The plan’s draft code had 12 mistakes of its own. For example, sanitize_text_field() strips %20 from UTM values.

Only then did I make the first real booking, from the local build, on a private test event. I got a 201, and Calendly accepted Asia/Calcutta.

I sent the same request again with the email in a different letter case. This time I got a 200, and Calendly still had just one event.

Booking panel confirming a booked demo

The first real booking, made from the local build on a private test event, 13 October 2026. Email address cropped out.

A QA pass in a real browser

The next day, an AI agent ran a QA pass on staging and came back with 14 findings. Before I fixed anything, I checked each one against the code and the live slot list.

Thirteen pointed to something real, though one got the symptom right but the cause wrong, and the agent rated two as more serious than they were.

One was a false alarm: the agent reported missing alt text, but it was there.

The most serious bugs were time zone edge cases my regression tests had missed. On 1 November in Los Angeles, when the clocks go back, two different slots both showed up as 1:00am. The zone caption also showed today’s offset after a clock change.

I now show the offset for repeated times and calculate the caption from the times on screen.

Before and after on staging

I measured both versions the same way on the redesign’s staging server on 13 October 2026. I used a Playwright script, ran it three times per version from one laptop in Thailand, and took the median.

Measure Embed Our panel
Requests 78 32
Transferred 4,419 KB 246 KB
A day can be clicked after, 1440 px 6,069 ms 4,044 ms
A day can be clicked after, 390 px 6,025 ms 4,131 ms
Panel height through the steps, 1440 px 748.8 to 1,253.8 px 546 px

I also ran Lighthouse 13.5.0 on the same staging URL, with the site’s third-party scripts left on. I used simulated throttling, did three runs per form factor, and ran the before and after sets 25 minutes apart.

Lighthouse, median of 3 Embed Our panel
Mobile LCP 2.88 s 2.89 s
Mobile Total Blocking Time 129 ms 123 ms
Desktop LCP 2.03 s 2.02 s
Performance score, mobile / desktop 84 / 79 83 / 78
Total bytes, mobile about 5,178 KB about 952 KB
Requests to Calendly 16 0

The two tables use different tools and settings, which is why their byte counts don’t match. Compare the numbers within each table, not across the two.

LCP didn’t improve, and the score dropped a point. The hero image is the LCP element in both versions, so taking out the embed couldn’t change that. On staging, mobile LCP stayed above the 2.5 s budget.

Here’s what did change: transferred bytes fell by 94% in the Playwright run (4,419 to 246 KB), Calendly’s requests dropped to zero, and a visitor could pick a day about two seconds sooner.

On production, seven weeks later

On 30 November I measured the live page against a private copy of the page it replaced, a request form with no calendar. I used Lighthouse 13.5.0, ran it five times on each page, and took the median. I blocked third-party scripts on both so only each site’s own code counted.

Book a Demo, own code only Old page New page
Mobile score 94 97
Mobile LCP, simulated 2.53 s 2.33 s
Desktop LCP, simulated 0.81 s 0.72 s
Transferred, mobile 749 KB 281 KB

The live panel still measures 535 × 546 px at 1440 and 350 × 476 at 390, just as it did on staging.

With the third-party scripts still on, the new page’s mobile LCP was 3.50 s. I can’t compare that with the old page. On the old copy the cookie banner never appeared, probably because the consent account is tied to zipher.ai, so its analytics loaded right away.

What did not improve

  • LCP. I covered this above: if the embed isn’t your LCP element, taking it out won’t fix LCP.
  • WordPress start-up. On staging, I saw a median of 1.358 s in the PHP access log over 62 uncached requests. Every slot request pays that cost. I could skip it by having the cron job write a static slot file, but I haven’t built that.
  • The script budget. booking.js is 7,608 bytes gzipped against a 6,144-byte budget. It’s over budget, and I accepted that.

A launch-day catch

I launched the redesign with the host’s staging-to-live push. That push also copies wp-config.php, so from about 07:10 to 07:28 UTC, production pointed at the private test event instead of the real demo event.

I caught it when I measured after the push and switched it to the real demo event. No visitor booked the test event.

If you’re on a similar host, here’s what I’d do: make sure the staging config is right for production before you push.

If you want to build one

Here’s what my design depends on, so you can check your own stack first.

  • Cron. The five-minute warmer and the HubSpot retries need WP-Cron, or a server cron where DISABLE_WP_CRON is set. Without that, the retries never run and visitors pay for cold fetches.
  • PHP-FPM. I use fastcgi_finish_request() to refresh after the response. Elsewhere, the refresh falls back to a spawned cron run.
  • A lead that can’t be lost. I give HubSpot 4 seconds. On a 5xx, 429 or network error, my code stores the lead and retries at 5 minutes, 30 minutes and 3 hours. If it still fails, the code emails the lead to an alert address and only deletes the stored copy if that email went out.
  • No webhooks. I don’t need any for this design.
  • Limits of version one. The panel detects the zone, but visitors can’t choose it. It’s English only. I didn’t add a CAPTCHA, but I left a field for one. Cancel and reschedule links only come from Calendly’s email.

Is replacing the embed worth it?

Not for every site. If the booking page is a side door, I’d keep the embed and reserve its height.

It was worth it here because the whole site points to the booking page. Every page has a Book a demo button in its header. The design had a fixed box for the panel, and I had to send the lead to the CRM from the server.

People see the panel. But it’s the server that can lose a lead or book someone twice, and that’s where I made most of my mistakes.

FAQs

Here are some common questions about replacing a Calendly embed with a custom booking flow.

How heavy is a Calendly inline embed?
On the page I measured in a local build on 13 October 2026, the embed loaded about 51 requests and 4.2 MB: 16 requests from Calendly's own domain and 35 from 15 other hosts inside the iframe. Measure your own page on more than one day, because third-party weight changes.
Can you build your own booking UI with the Calendly API?
Yes. A server reads open slots with GET /event_type_available_times and creates the booking with POST /invitees, and the visitor only sees your panel. Check your plan's limits first: as of 30 November 2026, Calendly lists 5 booking requests per user per day on the Free and Trial plans.
Does Calendly still send the confirmation email?
It did for the test booking made through the API. The panel then tells the visitor that a calendar invite is on its way.
Will removing the embed improve LCP?
Only if the embed is the LCP element. Here it was the hero image, so mobile LCP stayed at 2.88 to 2.89 s on staging. What dropped was page weight and the wait before a day could be clicked.
What happens if Calendly's API is down or the script fails?
The visitor gets a link to the regular Calendly page. The link is always in the HTML, and a CSS-only rule shows it after six seconds if the script never runs.

Summary

A Calendly embed added about 4.2 MB to one page, and the panel changed height at every step. I built my own panel using Calendly’s API. That took the staging page from 4,419 KB to 246 KB, and the panel stayed the same size throughout.

LCP didn’t improve, and I spent most of my time on the server side. If you build one, have someone poke holes in your server design before you write any code. Then have them do it again once the tests pass.

Summarize with AI Claude ChatGPT Google AI
Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!