Solving Iframe Blocking

by Sophie Daniline - May 20, 2019
Solving Iframe Blocking

Last year, Matt shared some of the common questions we get about integrating Google Analytics with Pardot. Today, I’m going to share an issue I’ve come across since then, concerning iframe blocking the UTM parameters from passing.

The problem

If you have set your Google Analytics Connector up properly, and are still finding that your UTM parameters are not passing through properly, then you may be experiencing a case of iframe blocking.

Sometimes, when you place a Pardot form on a webpage using an iframe, the parent page’s URL parameters are not automatically passed to the iframe. This can cause issues, primarily with tracking.

The fix

Luckily, there is a fairly simple JavaScript fix.

All you have to do is insert the following code on your webpage. Be sure to replace both instances of PARDOT_FORM_URL with your form’s URL.

<noscript>
 <iframe src="PARDOT_FORM_URL" width="100%" height="500" type="text/html" frameborder="0" allowTransparency="true" style="border: 0"></iframe>
</noscript>

<script type="text/javascript">
 var form = 'PARDOT_FORM_URL';
 var params = window.location.search;
 var thisScript = document.scripts[document.scripts.length - 1];
 var iframe = document.createElement('iframe');

 iframe.setAttribute('src', form + params);
 iframe.setAttribute('width', '100%');
 iframe.setAttribute('height', 500);
 iframe.setAttribute('type', 'text/html');
 iframe.setAttribute('frameborder', 0);
 iframe.setAttribute('allowTransparency', 'true');
 iframe.style.border = '0';

 thisScript.parentElement.replaceChild(iframe, thisScript);
</script>

This code will make the iframe load with the same parameters of the parent page, allowing you to capture those all important UTM parameters.

If you need any advice on this, or anything else regarding the Google Analytics Connector, please get in touch.

Related Content


Get In Touch

Whatever the size and sector of your business, we can help you to succeed throughout the customer journey, designing, creating and looking after the right CRM solution for your organisation