I’m working on a website that already has this HubSpot tracking code installed:
<script type="text/javascript" language="javascript">
var portal_id = 789012;
var version_log = "2.00";
var tracking_domain = "client-portal.app15.hubspot.com";
document.write(unescape("%3Cscript src='" + document.location.protocol + "//" + tracking_domain + "/salog.js.aspx' type='text/javascript'%3E%3C/script%3E"));
</script>
Now I need to implement this second script that someone said is also for HubSpot analytics:
<script type="text/javascript">
(function(doc, tag, identifier, refresh) {
if (doc.getElementById(identifier)) {return;}
var element = doc.createElement(tag), first = doc.getElementsByTagName(tag)[0];
element.id = identifier;
element.src = '//js.hubspot.com/analytics/' + (Math.ceil(new Date()/refresh) * refresh) + '/789012.js';
first.parentNode.insertBefore(element, first);
})(document, "script", "hubspot-analytics", 300000);
</script>
I’m confused about whether these are two different HubSpot scripts that serve different purposes, or if one is just a newer version of the other. Can someone explain what each one does and if I need both of them on the same page?