How is a variation assigned in a Matomo A/B test, and does it require a server request?
Cloud On-Premise
When a visitor enters an A/B test for the first time, Matomo randomly assigns a variation using JavaScript in their browser. The browser determines which variation to display without requesting an assignment from the Matomo server.
Ensure a user sees the same variation
To ensure visitors see the same variation on subsequent visits, Matomo stores the assigned variation name in the browser:
- Local Storage: By default, Matomo uses the browser’s Local Storage when supported.
- Cookies: If Local Storage is unavailable, Matomo sets a cookie for up to one year to remember the assigned variation.
This allows Matomo to show the same variation when a visitor returns to your website using the same browser, provided the stored information remains available.