Created
May 26, 2018 00:08
-
-
Save jakebellacera/ae85bdd58fc624bf9a77be2d891b8540 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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