Writing and reading
If the key already exists,
_set() replaces the previous value. If it is new, it is added. A key can therefore never appear twice in the cookie.Iterating over all pairs
Without a parameter,DC-CookieData() is a loop tag over all stored pairs.
Within the loop,
~DC-CookieData~ outputs the key of the current entry and ~DC-CookieData_get()~ its value. This lets you list the entire content of the cookie, which is helpful during development.Reusing a value
DC-CookieData_get() outputs, nothing more. If the value is to be used in a query or in another tag, provide it with _touchKey() and retrieve it via the two touched tags.
Reference: DC- (free parameters and session parameters)
Setting the cookie immediately
The shop only sends the changed cookie along with the next page. If the visitor leaves the shop directly after the page on which_set() appeared, nothing has been saved.
DC-CookieData_cookieHasChanged applies exactly when something in the cookie was changed on this page. Within it, you can additionally set the cookie in the browser.
DC-CookieData_cookieName and DC-CookieData_cookieValue are not listed as separate tags in the previous documentation, but they exist in the shop and are already used in the example above.Limits
The design cookie is intended for characteristics, not for data. Anything that should only apply within the session belongs in a session parameter
DC-SPX, and anything that belongs to the customer account belongs in the customer data.Overview of the tags
All tags are permitted in all templates.
Related topics
- Guide: Onsite personalization
- Materials: Cookies used
- Reference: DC- (free parameters and session parameters)
- Reference: CHECK- (URL and cookie data)
