Pardot Integration

1) Add utm-src as class to your iframe

<iframe loading="lazy" class="utm-src" style="border: 0;" src="{https://pardotform_src}" width="100%" frameborder="0" scrolling="no"></iframe>

This will help plugin to recognize the Pardot form and pass the UTMs collected on the site to Pardot form as query argument.

2) Create the following custom fields in Pardot and add them to your form.

utm_campaign – Collects utm_campaign variable.
utm_source – Collects utm_source variable.
utm_term – Collects utm_term variable.
utm_medium – Collects utm_medium variable.
utm_content – Collects utm_content variable.
gclid – Collects gclid variable.
fbclid – Collects gclid variable.

This is the bare minimum, you can add much more fields. Please see Native WP Shortcodes for the full list of parameters supported.

3) Go to Pardot Form and add the following snippet in "Below Form" section

<script type="text/javascript">
        // Parse the URL
        function getParameterByName(name) {
            name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
            var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
            results = regex.exec(location.search);
            return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
        }
        // Give the URL parameters variable names
        var source = getParameterByName('utm_source');
        var medium = getParameterByName('utm_medium');
        var campaign = getParameterByName('utm_campaign');
        var term = getParameterByName('utm_term');
        var content = getParameterByName('utm_content');
        var gclid = getParameterByName('gclid');
        var fbclid = getParameterByName('fbclid');
         
        // Put the variable names into the hidden fields in the form. selector should be "p.YOURFIELDNAME input"
        document.querySelector(".utm_source input").value = source;
        document.querySelector(".utm_medium input").value = medium;
        document.querySelector(".utm_campaign input").value = campaign;
        document.querySelector(".utm_term input").value = term;
        document.querySelector(".utm_content input").value = content;
        document.querySelector(".gclid input").value = gclid;
        document.querySelector(".fbclid input").value = fbclid;
</script>

Never lose any UTMs ever 💪

Get HandL UTM Grabber V3