Product analytics
Plan every event in code and validate it. Keep people out of it, record business facts on the server, and fix experiment rules before the start.
- Required 8
- Recommended 2
Required
Keep a tracking plan in the code
RequiredList every analytics event in one file in the repository, with its name, purpose, owner and properties. Name events as an object and a past-tense action.
Validate every event before you store it
RequiredCheck each incoming event against its schema at the collector. Store valid events, and set invalid ones aside with the reason.
Track only after consent
RequiredSend no analytics event that uses device storage or identifies a person until that person has agreed. Read the stored choice in the tracking module itself.
Keep personal data out of events
RequiredNever put names, email addresses, phone numbers, free text or full URLs with query strings in event properties. Use an internal ID that analytics cannot turn back into a person.
Record business facts on the server
RequiredRecord events that count money, sign-ups or other business facts on the server, at the moment the fact is committed. Use browser events only for behaviour in the page.
Write the experiment plan before it starts
RequiredBefore an A/B test starts, write down its one primary metric, guardrail metrics, minimum effect, sample size and stop date. Decide only at that sample size.
Assign each user to one variant for good
RequiredAssign variants by hashing a stable user ID with the experiment name, so a person sees the same variant on every visit and device. Log an exposure when the variant is shown.
Delete raw events on a schedule
RequiredKeep raw events with an analytics ID for a fixed time only, such as 14 months. Then delete them or roll them up into counts without IDs.
Recommended
Define each metric once
RecommendedDefine every business metric once, in version control, and build every dashboard and report from that definition.
Keep test and bot traffic out of the numbers
RecommendedMark every event from staff, test accounts, automated tests and known bots at the collector, and leave marked events out of every metric.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers data playbook: https://agentwranglers.se/playbook/data/product-analytics.