There's a new version of the HubSpot API

As of November 30, 2022, HubSpot API Keys are being deprecated and are no longer supported. Continued use of HubSpot API Keys is a security risk to your account and data. Your API Keys could be deactivated at any time after Nov. 30th, and we recommend that you migrate to Private Apps as soon as possible so you do not lose business-critical functionality.

Get cross-domain linking parameters

Last updated June 17, 2020

_hsq.push(['addIdentityListener', function(hstc, hssc, hsfp) {}])

Allows you to get the parameters needed to create cross-domain links. This will allow you to build links that support cross-domain tracking for links added after the page loads, or links that function using JavaScript instead of standard anchor tags. 

The HubSpot tracking code can be used across multiple sites with separate domains. This function will allow you to get the query parameters required to create create links that will allow you to track your visitors across those separate domains. These query parameters are used by the HubSpot tracking code to identify a visitor across domains by ensuring that the separate cookies for the separate domains are merged to a single tracked visitor.

Note: Cross-domain links are only needed when linking to a distinct domain (e.g., thisdomain.com and anotherdomain.com) that is also being tracked for a single HubSpot account. HubSpot tracking cookies are set at the domain level (.thisdomain.com), so visits between subdomains (www.thisdomain.com and blog.thisdomain.com) should not need the cross-domain link parameters.

Note: Cross-domain links are automatically set up by the HubSpot tracking code on load, so you should only need to update links that are dynamically added to the page after the tracking code is loaded.