Loading

Account Engagement: passing URL parameters from browser to iframe

Fecha de publicación: Sep 30, 2025
Descripción

NOTE: This is an advanced topic and requires JavaScript. Troubleshooting custom script is outside of Account Engagement Support's scope, so proceed with caution.

When you place an Account Engagement form on a webpage using an iframe, the parent page's URL parameters are not automatically passed to the iframe. This can cause issues with Google Analytics and first-touch reporting. Good news is that there is a relatively easy fix for this that uses just a little bit of JavaScript. This method makes an iframe load with the same parameters of the parent page. For example, you could use this script to capture UTM parameters or pre-fill iframed forms.

Solución

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>

Notes

  • Place the script where you want the form to appear.
  • If you want to include multiple iframed forms on the page, place the scripts where you want the forms to appear, and change the form URL.
  • For more, see this related article: Tracking Lead Source in Account Engagement
Número del artículo de conocimiento

000383147

 
Cargando
Salesforce Help | Article