# Hubspot tracking code

**URL:** <https://community.hubspot.com/t/hubspot-tracking-code/11804>\
**Category:** APIs & Integrations\
**Created:** [February 6, 2017, 8:26pm UTC](https://community.hubspot.com/t/hubspot-tracking-code/11804 "2017-02-06T20:26:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [February 6, 2017, 8:26pm UTC](https://community.hubspot.com/t/hubspot-tracking-code/11804/1 "2017-02-06T20:26:31Z")

</div>

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

```auto
<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.

```auto
<!-- 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.

---

<div class="post-metadata">

**Author:** ![3PETE](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/3pete/32/61905_2.png) [@3PETE](https://community.hubspot.com/u/3PETE)\
**Post date:** [February 6, 2017, 8:32pm UTC](https://community.hubspot.com/t/hubspot-tracking-code/11804/2 "2017-02-06T20:32:31Z")

</div>

[@ss\_integration](https://community.hubspot.com/u/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.

[

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/5/35a3f5b4cf3fc532e5e95d8b23f165c81e3a9401.png)

image.png1007x548 39.2 KB

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

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [April 13, 2018, 12:24pm UTC](https://community.hubspot.com/t/hubspot-tracking-code/11804/3 "2018-04-13T12:24:41Z")

</div>

Hi [@pmanca](https://community.hubspot.com/u/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://

---

<div class="post-metadata">

**Author:** ![RyanGamerTV](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ryangamertv/32/13521_2.png) [@RyanGamerTV](https://community.hubspot.com/u/RyanGamerTV)\
**Post date:** [February 24, 2020, 5:08pm UTC](https://community.hubspot.com/t/hubspot-tracking-code/11804/4 "2020-02-24T17:08:55Z")

</div>

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](https://js.hs-scripts.com/7082335.js)”\>\</script\>  
\<!-- End of HubSpot Embed Code --\>

---

<div class="post-metadata">

**Author:** ![cortiz32](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@cortiz32](https://community.hubspot.com/u/cortiz32)\
**Post date:** [June 8, 2024, 2:07am UTC](https://community.hubspot.com/t/hubspot-tracking-code/11804/5 "2024-06-08T02:07:46Z")

</div>

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