Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakebellacera/ae85bdd58fc624bf9a77be2d891b8540 to your computer and use it in GitHub Desktop.
Save jakebellacera/ae85bdd58fc624bf9a77be2d891b8540 to your computer and use it in GitHub Desktop.
/*
* 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