HubSpot Ideas

CBN

Tracking code as code and not script tag

In a number of case we want to control when the tracking codes are loaded. Our solution is also configurable as a white label soluton. In this case we DO NOT want to track anything to HubSpot.


The current tracking code only shows the script HTML tag:

 

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

 

This always loads and then we track where we should not track.

 

For this use it would be good to have the alternative implement shown below. Then I can setup tracking based on doman.

<script>
        if (window.location.href.indexOf('app.uqualio.com') > -1) {
            // <script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/8169108.js"></script>
            (function() {
                document.write('<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/XXXXXXX.js"><\/script>');
            })();
        }
    </script>

 

3 Replies
ronkinkade
Contributor

This would help in some cases, but I'd rather see Hubspot give us control over what scripts are loaded instead. In this case, this primary script loads other .js files like leadflows.js and banner.js also. If you aren't using these they can slow your website and become a resource we don't have control over.

CBN
Top Contributor

Good point @ronkinkade 

 

That would be even better. 

AbdullahAleem4
Member

IM THERE FOR ANY TYPE OF HELP YOU NEED.