Вопрос

Got a hubspot question. One of the sites my company maintains currently has the following code

<script type="text/javascript" language="javascript">
var hs_portalid=123456;
var hs_salog_version = "2.00";
var hs_ppa = "some-account-name.app12.hubspot.com";
document.write(unescape("%3Cscript src='" + document.location.protocol + "//" + hs_ppa + "/salog.js.aspx' type='text/javascript'%3E%3C/script%3E"));
</script>

We have been asked to add another snippet (below) which is claimed to be a hubspot analytics code

<script type="text/javascript">
    (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.hubspot.com/analytics/'+(Math.ceil(new Date()/r)*r)+'/123456.js';
        e.parentNode.insertBefore(n, e);
    })(document,"script","hs-analytics",300000);
</script>

Are these 2 versions (old and new) of the same code or are they different. Some links with explaination would be helpful. Thanks.

Это было полезно?

Решение

I have contacted the Hubspot's CS. Turns out that both snippets serve the same purpose and that the latter one is the new and improved version, which is also asynchronous, unlike the old one.

Unfortunately can't provide any links, all my searching came up empty, that is exactly why I asked the question in the first place.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top