Hello,
We have starting implementing Hubspot forms on our Wordpress site. The forms are embedded directly in the WP page (not hosted on a landing page). The problem is that causes a hole in Google Analytics tracking data because it can’t record conversions from the form (as the form is an iframe).
So what I’m hoping to find out is -
1) is it possible to insert the GTM tracking code, directly into the form code without impacting the performance of the form?
2) how/where in the iframe code should we insert the GTM code? GTM code looks like this:
3) if this isn’t possible, is there another way to track conversions from the HS forms in GA?
(Supposed to go in the <head> of the page)
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
new Date().getTime(),event:‘gtm.js’});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!=‘dataLayer’?‘&l=’+l:‘’;j.async=true;j.src=
‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,‘script’,‘dataLayer’,‘GTM-KWN39ZV’);</script>
<!-- End Google Tag Manager -->
(supposed to go after the <body> tag)
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src=“https://www.googletagmanager.com/ns.html?id=GTM-KWN39ZV”
height=“0” width=“0” style=“display:none;visibility:hidden”></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
Form Iframe code looks like this -
<script charset=“utf-8” type=“text/javascript” src=“//js-eu1.hsforms.net/forms/embed/v2.js”></script> <script>
hbspt.forms.create({
region: “eu1”,
portalId: “26880358”,
formId: “b943612f-2be1-4a17-bc37-1526253ad9e6”
});
</script>
I’ve had a look at other similar queries and they deal more with landing pages etc hosted by Hubspot; whereas this is just a form embedded in our Wordpress site.
Appreciate any help you might be able to give!
Many thanks.