Question from Reddit:
Hi,
We want to run LinkedIn campaigns where the conversion is a user scheduling a call with the team (via Calendly). How can I trigger the conversion pixel to fire when the user schedules the call?
It doesn’t seem possible to run it with GTM because the Calendly widget is in an iframe.
Has anyone done this and can guide me?
Answer from Nabil:
The short answer is:
You are correct that the embedded Calendly widget is typically within an iframe, which is the primary obstacle to standard client-side tracking, as GTM tags cannot access content or events inside another domain’s iframe.
The solution is to completely bypass the iframe with a server-side approach: first, by configuring Calendly to send data to your GTM container using its custom conversion script or DataLayer pushing, and second, by immediately passing that data to the LinkedIn Conversions API using a server-side tagging environment like Stape or Google Cloud Platform.
The long answer is:
The reason your LinkedIn conversion pixel cannot fire when a user schedules a call is, as you identified, the iframe that Calendly uses to embed its scheduler.
Browser security restrictions prevent JavaScript – and therefore GTM and the LinkedIn Insight Tag – from reading events that happen within an iframe hosted on a different domain.
The good news is that Calendly is designed with this problem in mind.
The first part of the solution is to use a Calendly-specific feature to get the conversion signal out of the iframe and onto your page’s DataLayer.
Calendly provides an option in its settings to pass event details to the parent window upon a successful booking, often via a custom callback function or a listener that pushes data to the main window’s DataLayer.
You would configure this to push a specific, custom event, like calendly_scheduled_event
, along with any useful booking details, into your web container’s DataLayer.
The second and most reliable part of the solution is to use server-side tagging to manage the LinkedIn conversion.
Once GTM receives the calendly_scheduled_event
event in the DataLayer of your main page, instead of trying to fire the fragile client-side LinkedIn Insight Tag, GTM sends this information as a data request to your server-side environment, hosted on a platform like Stape or Google Cloud Platform.
From this secure server, you then use the LinkedIn Conversions API (CAPI) to directly send the conversion data to LinkedIn.
The CAPI accepts server-to-server calls, eliminating the need for the browser, the iframe, or the client-side pixel to function correctly.
This method ensures your Scheduled_Call
conversion is tracked with high accuracy, is resilient to ad blockers, and provides better data matching by allowing you to include hashed customer details like email in the API call for superior conversion matching, which is crucial for optimizing your LinkedIn campaigns.