Issue with Hubspot tracking code in minification



We’re having issues with our Hubspot tracking code conflicting with our source code when it gets compiled.

The issue is with the Hubspot Events API script:
hstc.utils.hashDomain = function (e) {
var n = 0;
for (t = e.length - 1; t >= 0; t–) {
var i = e.charCodeAt(t);
n = (n << 6 & 268435455) + i + (i << 14),
i = 266338304 & n,
n = 0 !== i ? n ^ i >> 21 : n
return n
in the following line excerpt from above, they didn’t use a var declaration to scope t to the function. Therefore it’s being added to global scope as window.t which collides with our own application’s transpiled code.
Is there any way we can get var t=0; added before that for loop?

Thanks in advance!


@melissaceltx Thank for discovering a possible point of improvement for us. I’ll pass this along to our engineering team. We don’t release changes to the tracking code that often due the amount of customers who are all using it. I won’t be able to promise on a timetable on when this request will go through or even accepted by them.