Hubspot tracking code


When we started a few months back, we were using the following snippet for using the tracking code -

  (function(d,s,i,r) {
      if (d.getElementById(i)){return;}
      var n=d.createElement(s),e=d.getElementsByTagName(s)[0];;n.src='//'+(Math.ceil(new Date()/r)*r)+'/xxxxxxxxx.js';
      e.parentNode.insertBefore(n, e);

When we checked this recently, the instructions lists that we need to use the following snippet.

<!-- Start of HubSpot Embed Code -->
  <script type="text/javascript" id="hs-script-loader" async defer src="//"></script>
<!-- End of HubSpot Embed Code -->

Please let us know how we should proceed.


@ss_integration You should grab whatever is currently in your report settings. Both should work but we have released a newer version of it that involves less code on the client.


Hi @pmanca - that tracking script you provided is potentially insecure. The Hubspot script is available over HTTPS so should always be served over HTTPS. If the tracking script was used as it is on a HTTP site it would not be encrypted. Can you see if you can get that updated? Basically -don't use a protocolless link - start with HTTPS://