- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Using Tealium to inject Hubspot form into page
Aug 13, 2018 12:26 PM
Currently looking at injecting a Hubspot form into a page via Tealium TMS due to the fact that the CMS can't accommodate the form embed code.
We have the Tealium sync tag in place in the head of the page, which is where the code that loads the 2 JS files lives:
script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = '//js.hsforms.net/forms/v2-legacy.js';
document.getElementsByTagName('head')[0].appendChild(script);
script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = '//js.hsforms.net/forms/v2.js';
document.getElementsByTagName('head')[0].appendChild(script);
I then have some code that runs soon after that which checks every 200ms for the presence of the container div that the form will be replaced into and also checks that hbspt is defined. However, I'm noticing that the container div exists some time before hbspt is defined and therefore there is a noticeable amount of flicker from the time the main page loads to the point the hbspt method actually adds the form content.
Any help would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content