Skip to content

feat(demo): fire the X conversion event when a demo is booked - #6401

Merged
waleedlatif1 merged 1 commit into
stagingfrom
feat/x-pixel-demo-lead-event
Aug 8, 2026
Merged

feat(demo): fire the X conversion event when a demo is booked#6401
waleedlatif1 merged 1 commit into
stagingfrom
feat/x-pixel-demo-lead-event

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Fire the X (Twitter) conversion event tw-q5xbl-q5xbn when a demo booking is actually confirmed, so ad delivery optimizes toward bookings rather than form submits
  • There is no standalone demo confirmation page to drop the pixel snippet into — Cal.com renders the "you're booked" state inside its cross-origin iframe — so the event is wired to the embed's bookingSuccessfulV2 callback, unsubscribed on unmount
  • Gated on isHosted, matching how the landing layout gates the pixel base code: a self-hosted deployment loads no pixel and subscribes no ad-tracking callback
  • No CSP/COOP/COEP changes needed — static.ads-twitter.com (script-src) and analytics.twitter.com (connect-src, hosted-only) are already allowed, /demo is already exempt from strict COOP and runs COEP unsafe-none, and this adds no new origin

Type of Change

  • New feature

Testing

Type-check and lint clean. Not verified end-to-end in a browser — proving the conversion fires requires completing a real booking on the team calendar, so this should be confirmed on staging via the X Events Manager after deploy.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 8, 2026 3:04am

Request Review

@cursor

cursor Bot commented Aug 8, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Adds hosted-only marketing analytics on the demo scheduler with no auth, data, or CSP changes beyond existing X pixel allowances.

Overview
Fires the X conversion event tw-q5xbl-q5xbn when a Cal.com demo booking is confirmed, so ads can optimize on bookings instead of form submits. Because confirmation only appears inside Cal’s iframe, the handler listens for the embed’s bookingSuccessfulV2 event and calls window.twq via a module-scope trackDemoBooked callback.

Subscription is gated on isHosted, matching the landing layout’s X pixel—self-hosted builds neither load the pixel nor register the callback. The Cal useEffect now handles async getCalApi with a cancel flag, on/off for the booking listener, and swallowed promise errors on setup/teardown.

Reviewed by Cursor Bugbot for commit 2ee011d. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR records an X conversion after Cal.com confirms a demo booking.

  • Registers a hosted-only bookingSuccessfulV2 listener on the namespaced Cal embed.
  • Sends the fixed demo-booked conversion through the existing window.twq pixel queue.
  • Removes the listener during unmount and avoids initialization work after cancellation.

Confidence Score: 5/5

The PR appears safe to merge, with conversion tracking consistently gated to hosted deployments and cleaned up on unmount.

The booking callback uses the existing pixel initialization boundary, registers only after Cal initialization, and removes the same callback identity during cleanup; no blocking or independently actionable issue remains.

Important Files Changed

Filename Overview
apps/sim/app/(landing)/demo/components/demo-scheduler/demo-scheduler.tsx Adds hosted-only X conversion tracking for confirmed Cal bookings with cancellation-aware setup and matching listener cleanup; no actionable defect found.

Sequence Diagram

sequenceDiagram
  participant Visitor
  participant Scheduler as DemoScheduler
  participant Cal as Cal.com Embed
  participant X as X Pixel
  Visitor->>Cal: Complete demo booking
  Cal-->>Scheduler: bookingSuccessfulV2
  alt Hosted deployment
    Scheduler->>X: "twq(event, tw-q5xbl-q5xbn, {})"
  else Self-hosted deployment
    Scheduler-->>Scheduler: Tracking listener not registered
  end
Loading

Reviews (1): Last reviewed commit: "feat(demo): fire the X conversion event ..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit 3b4d587 into staging Aug 8, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/x-pixel-demo-lead-event branch August 8, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant