To ensure the persistence of your cookies, including the `optimizelyEndUserId` cookie, manage the cookie creation process at another point in your stack.
Many major CDN providers allow you to configure cookie creation as part of the response with your hosted content. This provides an option for UI-based and managed implementation of server-side cookie creation in many cases. Instructions can be found below for how to implement this in Akamai, if you use a different provider please feel free to reach out to your account team for more information on other providers.
Akamai provides the required cookie configuration options via the Property Manager. A JSON representation for creating the rule programmatically is also available.
To begin creating the cookie, create a new rule within the Akamai Project Configuration Settings to manage the cookie setting and updating process as part of your property’s responses.
This rule will need to contain two child rules: New Cookie and Refresh Cookie. The New Cookie child rule will manage the creation of a new cookie for visitors who do not yet have an `optimizelyEndUserId` cookie set. The Refresh Cookie child rule will refresh the cookie expiration for visitors who return with an existing cookie.
Here is the required configuration:
These settings will create a new cookie that meets the requirements to enable functional parity with the cookie that Optimizely currently sets within our client-side execution. These behaviors are:
Set to a unique value
Set to a duration of 180 days by default
Set on the top-level domain and base path of your choice
If you are leveraging Optimizely’s setCookieExpiration API to adjust your existing cookie expiration behavior, set the duration value as needed.