Add tracking script to form using onFormSubmit Problem

After adding a clients conversion tracking script to a form, the form is no longer rendering on the page. Here is the script on the page:

<!--[if lte IE 8]>
<script charset=“utf-8” type=“text/javascript” src=“//js.hsforms.net/forms/v2-legacy.js”></script>
<![endif]-->
<script charset=“utf-8” type=“text/javascript” src=“//js.hsforms.net/forms/v2.js”></script>
<script>
hbspt.forms.create({
portalId: “308538”,
formId: “1accc070-6f5e-4255-9bd9-0e605a0bcd6f”,
onFormSubmit: function($form) {
function gtag_report_conversion(url) {
var callback = function () {
if (typeof(url) != ‘undefined’) {
window.location = url;
}
};
gtag(‘event’, ‘conversion’, {
‘send_to’: ‘AW-734892296/oj8VCKK2sNMBEIiitt4C’,
‘event_callback’: callback
});
return false;
}
});
});
</script>

Here is the page the form is on in staging:

http://www-amarok-com.sandbox.hs-sites.com/contact?hs_preview=SLGbOBnk-32077702951

It looks as though the hbspt.forms.create is not firing

Here is the live page without the conversion code added which is rendering the form ok.

Hello @rix!,

Looks like you added a couple characters too many. If you remove the ); as you can see in the attached screengrab, you should be good to go!

Just to confirm it was working, I threw it up on a codepen as well. You can see it here

Post back if you have any other issues :slightly_smiling_face:

There it is! Perfect thanks