Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
* HubSpot's tracking code object is inaccessible from the global context, but by
* pushing functions to the HubSpot tracking code's queue, you can access it via
* the arguments passed to the callback function.
*/
_hsq.push(function(hstc, ctx) {
console.log(hstc); // HubSpot tracking code object
console.log(ctx); // HubSpot tracking code context
// The script below will set a cookie in the HubSpot context for 365 days
hstc.cookie.set("foo", "bar", {
daysToExpire: 365
});
// This script below will get the cookie
var foo = hstc.cookie.get("foo");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.