HubSpot Tracking in Foundation - HL Vanilla Community
<main> <article class="userContent"> <p>If you are using the Foundation theme and you want to add your HubSpot tracker to the community and the Knowledge Base, use the <strong>JavaScript</strong> tab in Theme Editor.</p><div class="embedExternal embedImage display-large float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6030677/uploads/NE8FW6LNZWDC/image.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6030677/uploads/NE8FW6LNZWDC/image.png" alt="image.png" height="179" width="1386" loading="lazy" data-display-size="large" data-float="none"></img></a> </div> </div> <h2 data-id="hubspot-code-example">HubSpot code example</h2><p>Copy the code from below and paste it on the <strong>JavaScript</strong> tab.</p><p>🛑 <strong>IMPORTANT</strong>: Be sure to replace the <strong>XXXXXX.js</strong> in the example with <em>your current HubSpot ID</em>.</p><pre class="code codeBlock" spellcheck="false" tabindex="0">/**  * 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); } </pre><p>To learn more about Analytics Events in the Foundation theme, see the detailed explanation of the code and the process in:</p><div class="js-embed embedResponsive" data-embedjson="{"body":"The custom pageView event described in this article is available starting from the following releases. Knowledge Base Pages - 2020.006 Community Pages - 2020.009 The pageView event Every time the page changes Vanilla fires an event called pageView. You might wonder, \"Why do I need an event? Doesn't javascript normally…","photoUrl":"https:\/\/us.v-cdn.net\/6030677\/uploads\/VWGAXAF5OFCO\/microsoftteams-image.png","url":"https:\/\/success.vanillaforums.com\/kb\/articles\/271","embedType":"link","name":"Analytics Events - Vanilla Success"}"> <a href="https://success.vanillaforums.com/kb/articles/271" rel="nofollow noreferrer ugc"> https://success.vanillaforums.com/kb/articles/271 </a> </div><p><br></p> </article> </main>