Hubspot tracking code


#1

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

<script>
  (function(d,s,i,r) {
      if (d.getElementById(i)){return;}
      var n=d.createElement(s),e=d.getElementsByTagName(s)[0];
      n.id=i;n.src='//js.hs-analytics.net/analytics/'+(Math.ceil(new Date()/r)*r)+'/xxxxxxxxx.js';
      e.parentNode.insertBefore(n, e);
  })(document,"script","hs-analytics",300000);
</script>

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="//js.hs-scripts.com/xxxxxxxx.js"></script>
<!-- End of HubSpot Embed Code -->

Please let us know how we should proceed.


#2

@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.


#3

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://