Skip to main content

Below is a preview of how your HubSpot form embed code should look after you follow the instructions for installing Insiteful’s form tracking code. The changes are highlighted in green.

Important: This form is demo purposes only, contact us here if you have questions. Be sure to replace the HubSpot form and portal ID with your own when installing on your site!

© Copyright 2019—2022. All Rights Reserved, Insiteful (insiteful.co). NO re-distribution, re-sale, modification, or unauthorized use.

(Modified) HubSpot form + Insiteful tracking:

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
hbspt.forms.create({
  portalId: "19702558",
  region: "na1",
  formId: "44ad3a51-eed2-4f2d-aca5-befe408267a1",
  onFormReady: function($form){
    window.f = $form;
    $form.append('<script id ="insiteful_1" type="text/javascript">const getScript=(e,t)=>{var a=document.createElement("script"),n=document.getElementsByTagName("script")[0];a.async=1,a.onload=a.onreadystatechange=((e,n)=>{(n||!a.readyState||/loaded|complete/.test(a.readyState))&&(a.onload=a.onreadystatechange=null,a=void 0,n||t&&t())}),a.src=e,n.parentNode.insertBefore(a,n)}; getScript( "https://a.insiteful.co/dist/compile.min.js", function() { \
    insiteful_activate("Y2I5YmU3ZDctMTIxOS0xMWVhLTkwOTctOTI1ZThhNjhhYmU2"); }); \
    <' + '/' + 'script> '); // © Copyright. All Rights Reserved, Insiteful (insiteful.co). NO re-distribution, re-sale, modification, or unauthorized use. 
    $form[0].ownerDocument.defaultView.eval($form.find("script#insiteful_1").text()); // insiteful
    var win_hs = document.querySelector('.hbspt-form iframe').contentWindow;
    window.addEventListener('beforeunload', (event) => { win_hs.saveForm(); });
    window.addEventListener('unload', (event) => { win_hs.saveForm(); });
    var hb_parent = document.querySelector('.hbspt-form iframe').parentElement;
    hb_parent.insertAdjacentHTML('beforebegin', '<div class="hbspt-form-msg" style="font-size: 13px;line-height: 1.5;font-family: inherit;border-radius: 3px;background: rgb(245, 248, 250);padding: 10px 15px;opacity:0.75;color: #33475b;background-color: rgb(245, 248, 250);border: 1px solid rgb(203, 214, 226);"><strong>NOTE: </strong>Your privacy is important to us. To better serve you, the information you enter in this form is recorded in real-time.</div>');
  },
  onFormSubmit: function($form) {
    var win_hs = document.querySelector('.hbspt-form iframe').contentWindow;
    win_hs.in_fh = {}; win_hs.in_fe = {}; // insiteful
  }
});
</script>

 

(Original) HubSpot form embed code

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
region: "na1",
portalId: "19702558",
formId: "44ad3a51-eed2-4f2d-aca5-befe408267a1"
});
</script>

Preview:

Was this post helpful?

Get your case studyAvailable for download immediately (no need to check your inbox)!