With the Foundation theme, if you are looking to add your HubSpot tracker to both the community and the KB, it is best you use the theme editor and the Javascript tab.
To translate how to make it work with a HubSpot example, replace the XXXXXX.js in code below with your current HubSpot ID
/**
* Stuff that executes when vanilla is finished loading.
*/
onVanillaReady(function () {
/**
* Hubspot Tracker
*/
addScript("https://js.hs-scripts.com/XXXXXXX.js");
})
function addScript(src) {
var s = document.createElement('script');
s.setAttribute('src', src);
s.setAttribute("async", "async");
s.setAttribute("defer", "defer");
document.body.appendChild(s);
}
To learn more about Analytics events in this theme, we have a detailed explanation of the code and process here.