Tracking script always persists a visitor ID in localStorage, which requires consent under ePrivacy / German TDDDG
Summary
Since the feature flags release (#1010), the tracking script writes a persistent random ID to localStorage on every page load (rybbit-visitor-id), even on sites that never use feature flags or identify().
This conflicts with the "no cookies, no consent banner" positioning. Under Art. 5(3) ePrivacy Directive (implemented in Germany as § 25 TDDDG), storing information on the user's device requires consent unless it is strictly necessary. This applies to localStorage the same way as to cookies, and analytics is not considered strictly necessary by the German DPAs.
Where it happens
getOrCreateVisitorId() runs unconditionally during config setup:
- https://github.com/rybbit-io/rybbit/blob/9cc84b825392db1bbc5d50f2e607806a385a8053/server/src/analytics-script/config.ts#L23-L36
- called at https://github.com/rybbit-io/rybbit/blob/9cc84b825392db1bbc5d50f2e607806a385a8053/server/src/analytics-script/config.ts#L140
As far as I can see, the ID is only used as anonymousId for feature flag evaluation:
Pageviews, sessions and events still rely on the server-side IP + UA hash, so the stored ID adds no value for plain analytics.
How to reproduce
- Open any site with the Rybbit script (self-hosted, current version).
- DevTools > Application > Local Storage.
rybbit-visitor-idis set with a UUID after the first load, no feature flags configured.
Context
#1084 introduces a persistent client ID as an explicit opt-in and notes that it means "trading it for a consent-banner obligation". That matches my reading, but the current script already persists an ID by default, without the opt-in.
Suggested fix
Only persist the visitor ID when it is actually needed, e.g.:
- only when the site uses feature flags or
identify(), or - behind the site setting from #1084, or
- a script attribute like
data-persist-visitor-id="false"
Otherwise generate it in memory per page load (createVisitorId() without localStorage).
Happy to test a fix on our self-hosted instance.
Source: rybbit-io/rybbit