Form is not generated into page

Hi all. We have a form we’re including via the Hubspot API from a self-hosted page. I’m receiving a javascript error “Uncaught ReferenceError: hbspt is not defined” when trying to display the form, see picture at Upload and share screenshots and images - print screen online | Snipboard.io. As a result, no form is created.

Some information:

- The page is found at Embedded Lending: Software Providers and Merchants. The form should be displayed at the bottom of the page, right before the footer.

- The code is:

<script charset=“utf-8” type=“text/javascript” src=“js.hsforms.net/forms/embed/v2.js”></script>

<script>

hbspt.forms.create({

region: “na1”,

portalId: “4139315”,

formId: “099ca015-dd21-4ea4-b08a-43bb6931c292”

});

</script>

- The page is from a WordPress site. The form only fails when the page is used anonymously. When logged into WordPress, the form displays fine.

- Hubspot support confirmed that the tracking code is firing as expected.

I have virtually no experience developing with Hubspot, so I’m hoping I just made a rookie error and this is easy to resolve. Any help is much appreciated!

Hi @ZWade ,

I think the problem might be the fact that the ‘defer’ tag is added to the script tag.

So if I inspect your page, you currently have this:
<script charset=“utf-8” type=“text/javascript” src=“//js.hsforms.net/forms/embed/v2.js” defer></script>

This might cause the script to execute at the wrong time which could cause the error.
Could you try removing the defer attribute?
If you have not added it yourself, you might have a WordPress plugin that is causing the script to get the defer tag.