Manage cookies

To report tracking data for one and the same person across different sessions consistently, the JavaScript SDK uses a cookie to save the subject ID of this person. By default, the name of the cookie is sf-data-intell-subject. You can change the name when instantiating the JavaScript SDK client via the subjectCookieName parameter. If there is no cookie present on initialization the client and no subjectKey parameter provided, a new cookie is automatically created and a corresponding GUID generated for the subject ID.

NOTE: If you are working with JavaScript SDK version 3.0 or newer, you cannot change the cookie name.

To make the cookie visible across sub-domains, you use the trackingCookieDomain parameter, thus making the tracking uniform. For example, if your website www.mysite.com has several sub-domains, say music.mysite.com, movies.mysite.com, and books.mysite.com. To track visitor interactions across all of the sub-domains, you set the domain of the JavaScript SDK cookie to .mysite.com via the trackingCookieDomain parameter:

GDPR compliance

In case visitors do not provide tracking consent, the site administrator may need to delete the cookie issued for the specific visitor. The sfDataIntell client exposes a deleteCookie method that requires a domain parameter. To do so, you need the trackingCookieDomain parameter, provided when you initialized the JavaScript SDK client.

When working with JavaScript SDK version 3.0 and newer, you can use the enableTracking parameter that reflects whether the data subject (website visitor) has approved or rejected the data collection consent.

The following code snippets demonstrate the two options for the enableTracking parameter:

  • Site visitor approved data collection:
  • Site visitor rejected data collection:

For more information about the parameters, described above, see Initialize the JavaScript SDK.

 

Was this article helpful?