Cookie policy

Overview

Contentful Personalization uses browser storage and cookies to maintain visitor identity and cache personalization state. This page documents what is stored, where, and why.

localStorage

Using any of our JavaScript SDKs will add the following localStorage items:

KeyPurpose
nt_anonymous_idThe visitor’s anonymous profile ID. Used to identify the visitor across page loads without server-side cookies.
nt_experiencesCached experience selections (which variant was assigned to which experience). Allows the SDK to render the correct variant immediately on subsequent page loads.
nt_profileCached visitor profile data (traits, audiences, session statistics). Reduces API calls on page load.

If you use the Privacy Plugin, it also stores:

KeyPurpose
nt-consentThe visitor’s consent state. Used to determine whether the SDK should send events and enable location features.

Cookies

If you implement server-side or edge-side personalization, your middleware or server code should set the following HTTP cookie:

CookiePurposeRecommended attributes
ntaidThe visitor’s anonymous profile ID for server-side personalization. Allows middleware and edge functions to identify returning visitors and call the Experience API with the correct profile.Path=/; Max-Age=31536000; SameSite=Lax; Secure

Important: The ntaid cookie must always be set from the Experience API response (response.data.profile.id), not from the incoming request cookie. After profile merges or relocations, the canonical profile ID may change. Using the old value leads to duplicate profiles.

The ntaid cookie and nt_anonymous_id localStorage value represent the same profile ID. The SDK reads nt_anonymous_id in the browser. Server-side code reads ntaid from the cookie. Both should refer to the same visitor.

sessionStorage

Contentful Personalization does not set any sessionStorage keys.

Source reference

For reference, the storage key constants are visible in our open-source SDKs.