Hubspot tracking code

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.

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

[

image.png1007x548 39.2 KB

](https://community.hubspot.com/legacyfs/online/uploads/default/original/1X/ffe8008d42f9b6c6c324c3ac01392077e3f71d3d.png)

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

I need help with the traking code.

<!-- Start of HubSpot Embed Code -->
<script type=“text/javascript” id=“hs-script-loader” async defer src=“//js.hs-scripts.com/7082335.js”></script>
<!-- End of HubSpot Embed Code -->

<!-- Start of HubSpot Embed Code -->
<script type=“text/javascript” id=“hs-script-loader” async defer src=“//js-na1.hs-scripts.com/46411655.js”></script>
<!-- End of HubSpot Embed Code -->