With Inspectlet, you can now tag sessions with a HubspotID by using the 'hubspotutk' cookie.
Here's how it works:
Using the code below, you can collect the value of the 'hubspotutk' cookie and send it to Inspectlet as a tag:
function hubspotCookie() {
return document.cookie.replace(/(?:(?:^|.*;\s*)hubspotutk\s*\=\s*([^;]*).*$)|^.*$/, "$1");
}
__insp.push(['tagSession', {hubspot_id: hubspotCookie()}]);
The example Inspectlet code will now look like:
<!-- Begin Inspectlet Embed Code -->
<script type="text/javascript" id="inspectletjs">
window.__insp = window.__insp || [];
__insp.push(['wid', 12345678]);
function hubspotCookie() {
return document.cookie.replace(/(?:(?:^|.*;\s*)hubspotutk\s*\=\s*([^;]*).*$)|^.*$/, "$1");
}
__insp.push(['tagSession', {hubspot_id: hubspotCookie()}]);
(function() {
function ldinsp(){if(typeof window.__inspld != "undefined") return; window.__inspld = 1; var insp = document.createElement('script'); insp.type = 'text/javascript'; insp.async = true; insp.id = "inspsync"; insp.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://cdn.inspectlet.com/inspectlet.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(insp, x); };
setTimeout(ldinsp, 500); document.readyState != "complete" ? (window.attachEvent ? window.attachEvent('onload', ldinsp) : window.addEventListener('load', ldinsp, false)) : ldinsp();
})();
</script>
<!-- End Inspectlet Embed Code -->
Check if it it's installed correctly
To debug whether Inspectlet is installed and functioning correctly, append ?inspectlet_diagnostics=true to your website URL to bring up the diagnostics console.
If you have any questions, please send us an e-mail at hello@inspectlet.com!