Install AnalyticsJS on a HubSpot website

Get the code snippet from your customer success manager

If you don't already have the primary code snippet (the code that goes into the head of the site), email your customer success manager for it.

If you're identifying prospects from email form submits, you'll need the following code for the footer of the website:

(function(){function n(e,t,n){if(e.addEventListener){e.addEventListener(t,n,false)}else if(e.attachEvent){e.attachEvent("on"+t,n)}}function l(e){var t=e.querySelectorAll("input[type=text], input[type=email]");var n={};var i,a,r;for(var l=0;l<t.length;l++){i=t[l];if(!a&&i.getAttribute("type")==="email")a="email";r=i.value;if(!a||!r)continue;n[a]=r}return n}function i(e){var;var n=l(t);if(!;var i=e.defaultPrevented;e.preventDefault();var a;var r=function(){if(a)return;if(i)return;a=true;t.submit()};setTimeout(r,400);if(analytics){analytics.identify(,{})}else{if(console&&console.warn){console.warn("CaliberMind: analytics is not defined during submit")}}}n(window,"load",function(){var e=document.querySelectorAll("form");for(var t=0;t<e.length;t++){n(e[t],"submit",i)}})})();

Paste the primary code snippet into the head of the site

Take the primary code snippet provided to you by your customer success manager and paste it into the head of the site.

Not sure how to do that in HubSpot? Check out their extensive documentation on the topic.

Take the code snippet above and paste it into the footer of the site.

Note that if you have multiple HubSpot websites hosted on multiple domains, and you already have code in the configuration for a specific domain, the global configuration will not be inherited by the specific domain. You'll need to paste the code into each specific head / footer.

Using embedded HubSpot forms? Read our knowledgebase article about using AnalyticsJS with embedded HubSpot forms.

How did we do?

Powered by HelpDocs

Powered by HelpDocs