How to Use GTM with Pipedrive Web Forms via iFrame Redirect?

Question from user:

Hi there – we want to implement tracking through an iFrame  using Google Tag Manager.  How do we add a GTM code to the iFrame URL?

I note a while ago it wasn’t possible – has this been updated please

Thanks

Katie

Answer from Nabil:

The short answer is:

How do I implement GTM tracking with Pipedrive web forms using an iFrame redirect?

No, you generally cannot directly add Google Tag Manager (GTM) code to the iframe URL of your Pipedrive forms because the iframe loads content from a different domain (Pipedrive’s server), making it difficult to control the tracking within that frame.

The current and most recommended workaround, as mentioned in the thread, is to set up a redirect to a success page on your own domain after the form submission and place your GTM tracking code on that success page to capture the conversion event.

The long answer is:

The reason you can’t simply append GTM code to the iframe URL is due to security restrictions, primarily the same-origin policy, and the fact that the iframe’s source is controlled by Pipedrive.

To implement tracking directly, the GTM container snippet needs to be present within the HTML of the page being loaded inside the iframe, which you don’t control.

The redirect workaround is the most straightforward solution for tracking the conversion event like a successful form submission.

You’d configure the Pipedrive web form’s “Success Page” to “Redirect to another webpage” and input the URL of a page on your website, for example, a “Thank You” page.

On this custom success page, your GTM container is already installed, and you can fire a tracking event, such as a Google Analytics 4 (GA4) event like generate_lead or a Google Ads conversion tag, upon page load, indicating the form completion.

For a more robust and server-side tracking solution, which is excellent for accuracy and future-proofing, you can leverage the Pipedrive API in combination with Google Tag Manager and a Server-Side Tagging solution like Stape or Google Cloud Platform (GCP).

When a form is submitted, Pipedrive creates a deal or person, which is an event accessible via its API.

You can set up a system (often using a server or a service like Zapier/Make) to listen for the form submission or deal creation event from the Pipedrive API.

When this event occurs, your system sends the conversion data directly to your GTM Server-Side Container.

This server-side container then forwards the data to tracking destinations like GA4, Facebook Conversions API, or Google Ads.

This approach is superior because it mitigates the tracking loss caused by ad-blockers and browser restrictions (like Intelligent Tracking Prevention or ITP) and keeps sensitive customer data off the user’s browser, leading to more reliable conversion data and a better privacy posture.

For example, when a new lead is created in Pipedrive, the API webhook triggers an endpoint on your server, which then sends a server-side event to GTM’s Server Container with the required details like a lead ID and the event name generate_lead.

This method gives you complete control over the data being sent and is not affected by the iframe’s limitations.

About The Author