Pipedrive Form Conversion Tracking
Do you have a Pipedrive form in your website, and you need to track it to measure leads in Google Ads, Meta Pixel, Facebook CAPI, Google Analytics or others? Here’s the short and sweet, to-the-point code snippet you are looking for.
I’m going to be re-visiting the Pipedrive iFrame form conversion tracking in more depth. I just had a client who did not figure it out. So I made an iFrame JavaScript listener code for Pipedrive forms.
Pipedrive forms kinda suck for tracking
Sidenote here - 29. Jan 2025
These are one of the worst forms I’ve tracked. It’s nice that Pipedrive has a JavaScript message. But it does not output field values so we can’t do Enhanced conversion tracking or Meta Pixel advanced matching on the frontend.
Usually this means API conversion enhancements, but those don’t work either as Pipedrive doesn’t seem to output anything we need. No email, no phone, not the formUUID: "idltng1 thing.
We cannot do offline conversion tracking using enhanced conversions for leads because we don’t get the phone or email.
And we can’t do classic offline conversion tracking because fields cannot be prepopulated (at least the URL inherit method which works for all other platforms, does not seem to work for Pipedrive)
Even the outdated redirect to a custom thank you page method does not offer the field values.
So we can get some tracking but not a serious setup. I will update if I find solutions.
So my recommendation if you’re serious about digital marketing, would be to use a different form like Tally.so and connect that with Pipedrive and get perfect tracking set up.
Moving on…
Pop the code below in Google Tag Manager “Custom HTML” tag and make a trigger for custom event ‘pipedrive_form_submit’.
For Enhanced conversion tracking, CAPI etc a pure Google Tag Manager JavaScript solution is not enough. We need API’s for hybrid approach to send conversion enhancement within 24h of the Google tag Manager web conversion. However this seems more complex than it usually is for other platforms.
I will make tests to see if formUUID: "idltng1" is a unique identifier of the specific form or the submission. We need to be able to match the web conversion server-side to do proper tracking, as cookie-based tracking is no longer enough and we must also use first-party data to get accurate results. But this code below get’s you started, at least 60% of the way.
// Listen for message events from Pipedrive webforms
window.addEventListener('message', function(event) {
// Only process messages from Pipedrive webforms
if (event.origin.includes('webforms.pipedrive.com')) {
try {
const data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
// Check if it's a Pipedrive webform submission
if (data.payload && data.payload.source === 'pipedriveWebForms') {
console.log('Pipedrive Webform Submission:', data);
// Push to dataLayer
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'pipedrive_form_submit',
'formUUID': data.payload.uuid,
'formWidth': data.payload.width,
'formHeight': data.payload.height
});
}
} catch (error) {
console.error('Error processing Pipedrive message:', error);
}
}
}, false);