Does A/B testing need cookie consent?

Last updated: 29 November 2026.

In the EU, an A/B test that stores an ID in the visitor's browser, in a cookie or in local storage, can need the visitor's consent under Article 5(3) of the ePrivacy Directive. The European Data Protection Board reads the rule as also covering an ID that a script keeps only in memory and sends with each request, so a test that keeps nothing in browser storage may still need consent. The decision is the site owner's, and this page is not legal advice.

What the rule says

Article 5(3) of the ePrivacy Directive requires consent for storing information on, or reading it from, a visitor's device, with 2 narrow exceptions. The text in force since the 2009 amendment says:

"Member States shall ensure that the storing of information, or the gaining of access to information already stored, in the terminal equipment of a subscriber or user is only allowed on condition that the subscriber or user concerned has given his or her consent, having been provided with clear and comprehensive information [...] about the purposes of the processing. This shall not prevent any technical storage or access for the sole purpose of carrying out the transmission of a communication over an electronic communications network, or as strictly necessary in order for the provider of an information society service explicitly requested by the subscriber or user to provide the service."

An A/B test is rarely the service the visitor asked for, so the second exception usually does not cover it. That leaves consent, unless a national exemption covers your test.

It covers more than cookies

The rule covers anything stored on or read from the device, not only cookies. The European Data Protection Board (EDPB) says so in its Guidelines 2/2023 on the technical scope of Article 5(3), version 2.0, adopted on 7 October 2024:

  • Article 5(3) "does not exclusively apply to cookies, but also to 'similar technologies'".
  • Storage "refers to placing information on a physical electronic storage medium that is part of a user or subscriber's terminal equipment".
  • The guidelines name "cookies, local storage, WebSQL" as information stored inside the browser. Using it on the device alone is not "gaining of access", but "when this information or any derivation of this information is accessed, Article 5(3) ePD would apply".
  • The ePrivacy Directive "does not place any upper or lower limit on the length of time that information must persist on a storage medium to be counted as stored", and storage media include "random-access memory ('RAM')".
  • JavaScript that instructs the browser "to send asynchronous requests with the targeted information" is access that "clearly falls within the scope of Article 5(3) ePD". When client-side code makes the browser send a unique identifier, "a 'gaining of access' is taking place and Article 5(3) ePD applies".
  • Relying on browser mechanisms such as the User-Agent header to collect information, "for example in the context of fingerprinting", "can lead to the application of Article 5(3) ePD".

For an A/B test, this means that moving the visitor ID from a cookie into local storage does not change the answer. An ID that a script keeps only in memory and sends with each request can also fall under the rule, and so can an ID built from the visitor's browser details.

What differs by country

Each EU country writes the directive into its own law, and its regulator decides how to read it. France's regulator, the CNIL, exempts some audience measurement from consent. Its page on audience measurement tools, dated 4 July 2025, says the trackers must be used "pour une finalité strictement limitée à la seule mesure de l'audience du site ou de l'application" (for a purpose strictly limited to measuring the site's or app's audience), for the publisher alone, and must "servir à produire des données statistiques anonymes uniquement" (serve only to produce anonymous statistics).

Among the allowed purposes, the page lists improving the site's technical performance or its usability ("ergonomie"). It does not name A/B testing. The CNIL also recommends that a tracker last only long enough to compare audiences over time, giving 13 months as an example, and that the data be kept no more than 25 months. Whether a given A/B test fits the exemption is a judgment for the site owner and their adviser, not something this page can decide.

3 ways to run a test

You can run an A/B test in 3 ways under these rules: ask first, keep nothing in browser storage, or decide that your test is exempt where you operate. Pickbook A/B supports all 3. Only the first one waits for a visitor's yes before the test runs.

  1. Ask first. Add data-consent="wait" to the Pickbook A/B script tag. Until your page calls pickbook.consent(true), the script stores nothing and sends nothing, and every visitor sees the first version and is not counted. Call pickbook.consent(false) when a visitor says no or withdraws: it removes what Pickbook A/B stored in the browser.
  2. Keep nothing in browser storage. Add data-storage="none". The script then reads and writes nothing in local storage or session storage, so nothing stays on the device after the page closes. It still keeps a random ID in memory while the page is open and sends it with each request, which the EDPB reads as covered by Article 5(3), so a test in this mode may still need consent. To run the test only after a yes, use data-consent="wait" as well.
  3. Decide that you are exempt. If your adviser concludes that your test falls under an exemption, such as the CNIL's, you can use the default script. It sets no cookies and keeps a random ID and the version seen in local storage.

You can also add data-respect-gpc to treat a browser that sends Global Privacy Control as a no. Such a visitor sees the first version and is never stored or counted.

What each choice costs in visitors and time

Each privacy choice makes a test take longer, because the test needs the same number of counted visitors either way.

What each Pickbook A/B mode stores, and what it costs your test
ModeStored on the deviceWho is countedCost
DefaultA random ID and the version seen, in local storageEvery visitor in the testNone
data-consent="wait"Nothing until consentOnly visitors who agreeThe test takes longer. If half of your visitors say no, it takes about twice as long.
data-storage="none"Nothing in browser storage. A random ID stays in memory while the page is open and is sent with each request, so the test may still need consent.Every visit, as a new visitorThe goal must happen on the same page, a returning person may see the other version, and the test needs more visitors.

The modes are described in the Pickbook A/B script's documentation, checked on 29 November 2026.

Before you choose, check that your page gets enough visitors. If 3 in 100 visitors reach your goal, a test for a Medium difference needs about 31,000 counted visitors in total. Use What can I test with my traffic? to see what fits within 60 days, and read How Pickbook A/B picks a winner for how the answer is reached.

What to write in your privacy policy

Your privacy policy should say what the test stores on the device, what it sends, and where the data is kept. For the default Pickbook A/B script, you can write:

We use Pickbook A/B to compare versions of our pages. It keeps a random ID and the version you saw in your browser's local storage, sets no cookies, and stores that ID, the version, and whether you reached a goal on servers in the European Union. It does not receive your name or email address.

With data-storage="none", say instead that Pickbook A/B keeps nothing in the visitor's browser storage, uses an ID that lasts only while the page is open, and cannot link separate visits. Read Cookieless A/B testing for the full list of what the script stores and sends, and the data processing agreement for the terms. To compare how other tools handle this, read Privacy-friendly A/B testing tools compared. Plans are on the pricing section of Pickbook A/B.

Questions

Is local storage treated like a cookie?

Yes, for the EU consent rule. The EDPB's Guidelines 2/2023 name local storage among the kinds of information stored in the browser that Article 5(3) of the ePrivacy Directive can cover.

Do I need a banner if no cookie is set?

You may, because the rule covers any storage on the device, not only cookies. The EDPB also reads it as covering an ID that a script keeps only in memory and sends with each request, so a test with data-storage="none" may still need consent. To run a test only after a visitor says yes, use data-consent="wait". The decision is yours, and this page is not legal advice.

What happens to my test when visitors say no?

Visitors who say no see the first version and are not counted. The test still needs the same number of counted visitors, so it takes longer to reach its answer.

Does Global Privacy Control matter?

It can, and Pickbook A/B lets you respect it. Add data-respect-gpc to the script tag, and a browser that sends Global Privacy Control is treated as a no: that visitor sees the first version and is never stored or counted.

Sources

  1. Directive 2002/58/EC (ePrivacy Directive), consolidated text of 19 December 2009, Article 5(3), EUR-Lex, checked on 29 November 2026.
  2. EDPB Guidelines 2/2023 on Technical Scope of Art. 5(3) of ePrivacy Directive, version 2.0, adopted on 7 October 2024, checked on 29 November 2026.
  3. CNIL: Cookies, solutions pour les outils de mesure d'audience (in French), checked on 29 November 2026.