If you are using the Foundation theme and you want to add your HubSpot tracker to the community and the Knowledge Base, use the JavaScript tab in Theme Editor.
HubSpot code example
Copy the code from below and paste it on the JavaScript tab.
🛑 IMPORTANT: Be sure to replace the XXXXXX.js in the example 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.src = src;  s.async = true;  s.defer = true;  document.body.appendChild(s);}
Analytics events
To learn about the pageView and pageViewWithContext Analytics events in the Foundation theme, see the detailed explanation of the code and the process in: