Segment Cookie updated only after refreshing the page
ID: 647116
Backlog
Published on 11/1/2022
•
Last update on 1/10/2024
Summary
Some VTEX features and components can use data requested from the Segment Cookie to present information (like price, promotion data, SKU availability, etc) in the storefront. This cookie is stored in the user's browser when the session is created. Sometimes, mostly in dynamic scenarios where it needs to make changes in the front where it triggers a Cookie Segment update, the cookie itself loses some data which is a of a behavior in render-runtime that doesn't trigger segment change to the context
How to retrieve Session info: https://developers.vtex.com/vtex-rest-api/reference/getsession
You can get the Segment Cookie data through the segment token:
- Open the browser's console;
- Decode the segment token presented in the render runtime object;
- In the console, run:
atob(__RUNTIME__.segmentToken)
Simulation
- Select a store that presents information based on a Segment Cookie data:
- Ex.: Different prices are shown based on the customer identification - related to pricing tables;
- Get the Cookie Segment data in different scenarios using the app that retrieves the user identification;
Workaround
Refresh the page