{"playbook":"Product analytics and experiments","url":"https://agentwranglers.se/playbook/analytics","updated":"2026-10-27","license":"https://creativecommons.org/licenses/by/4.0/","credit":"Required by the licence: credit Agent Wranglers with a link to the rule or playbook you used.","ids":"Each rule has an id, such as PAY-14, that never changes. Open a rule by its id at /r/PAY-14. Its revision changes whenever its content changes.","how":"Each rule's How and Measured text is on its own page: add .md to its url.","rules":[{"id":"ANA-1","revision":"58bf74cc3e8b","updated":"2026-10-27","name":"Keep a tracking plan in the code","level":"Recommended","rule":"List 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.","check":"A test reads the plan and fails on any name that does not match `^[a-z]+(_[a-z]+)+$`. A grep finds no call to the raw `track(` function outside the generated module.","check_type":"static","url":"https://agentwranglers.se/playbook/analytics/events-and-metrics/tracking-plan","related":["/playbook/ai-features/logs-privacy-and-feedback/feedback-on-every-answer"],"sources":["https://json-schema.org/draft/2020-12"]},{"id":"ANA-2","revision":"a45ea9eaabfd","updated":"2026-10-27","name":"Validate every event before you store it","level":"Recommended","rule":"Check each incoming event against its schema at the collector. Store valid events, and set invalid ones aside with the reason.","check":"Send one valid and one invalid event to the staging collector. The valid one is in the events table, and the invalid one is in the rejects table with its error.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/events-and-metrics/event-validation","related":["/playbook/events/background-jobs-and-queues/dead-letter-queue","/playbook/architecture/data-shapes/parse-at-the-boundary"],"sources":["https://json-schema.org/draft/2020-12"]},{"id":"ANA-3","revision":"e028ab50c7a4","updated":"2026-10-27","name":"Record business facts on the server","level":"Recommended","rule":"Record 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.","check":"Place 20 test orders with an ad blocker on. The events table holds exactly 20 `order_completed` rows, matching the orders table. A daily query compares both counts and alerts on any difference.","check_type":"command","url":"https://agentwranglers.se/playbook/analytics/events-and-metrics/server-side-business-events","related":["/playbook/data-engineering/data-quality-tests/source-reconciliation","/playbook/events/publishing-events/outbox","/playbook/application-security/limits-and-business-logic/server-side-business-rules","/playbook/analytics/events-and-metrics/activation-rate"],"sources":[]},{"id":"ANA-4","revision":"02f19f42e45b","updated":"2026-10-27","name":"Keep test and bot traffic out of the numbers","level":"Recommended","rule":"Mark every event from staff, test accounts, automated tests and known bots at the collector, and leave marked events out of every metric.","check":"Run the browser test suite against staging with the header. The collector stores its events with the flag set. A query over every metric view finds no row built from a flagged event.","check_type":"http","url":"https://agentwranglers.se/playbook/analytics/events-and-metrics/exclude-test-traffic","related":["/playbook/data-engineering/data-quality-tests/volume-anomalies","/playbook/analytics/events-and-metrics/metric-definitions"],"sources":["https://support.google.com/analytics/answer/9888366","https://support.google.com/analytics/answer/10104470"]},{"id":"ANA-5","revision":"9fef9873c4f0","updated":"2026-10-27","name":"Define each metric once","level":"Recommended","rule":"Define every business metric once, in version control, and build every dashboard and report from that definition.","check":"A script lists every saved dashboard query and fails on any that computes a named metric without the shared view or metric. Two dashboards showing the same metric for the same day show the same number.","check_type":"command","url":"https://agentwranglers.se/playbook/analytics/events-and-metrics/metric-definitions","related":["/playbook/data-engineering/warehouse-and-models/transformations-as-code","/playbook/customer-support/measuring-support/contact-rate","/playbook/analytics/events-and-metrics/exclude-test-traffic","/playbook/documentation/keeping-docs-current/one-home-per-value","/playbook/analytics/events-and-metrics/activation-rate","/playbook/analytics/experiments/guardrail-metrics"],"sources":[]},{"id":"ANA-6","revision":"ad92b32b0cbd","updated":"2026-10-27","name":"Measure how many new accounts reach their first result","level":"Recommended","rule":"Define one activation event, such as the first invoice sent, and record it on the server. Report the share of each week's new accounts that reach it within 7 days.","check":"The metric file defines the activation event and the 7-day window. The dashboard shows the rate for each weekly sign-up group of the last 12 weeks.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/events-and-metrics/activation-rate","related":["/playbook/analytics/events-and-metrics/server-side-business-events","/playbook/analytics/events-and-metrics/metric-definitions"],"sources":[]},{"id":"ANA-7","revision":"e7d14d81694a","updated":"2026-10-27","name":"Track only after consent","level":"Required","risk":"law","applies":["eu-users"],"region":["EU"],"rule":"Send 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. Without a yes, count visits only, with no cookie, no device storage and no ID.","check":"A browser test with a fresh profile clicks through sign-up and checkout without consenting. The collector receives no event with a user or device ID, and no analytics storage exists. The stored count rows hold no IP address, user agent or ID.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/privacy-and-consent/analytics-consent","related":["/playbook/website/performance/field-measurement","/playbook/stack/product-services/plausible-analytics","/playbook/mobile-apps/privacy-declarations/tracking-permission","/playbook/data-engineering/personal-data-in-the-warehouse/reverse-sync-objections","/playbook/desktop-apps/crashes-telemetry-and-accessibility/telemetry-opt-in","/playbook/seo/ai-search-answers/ai-referral-traffic","/playbook/website/privacy/cookie-consent","/playbook/website/privacy/global-privacy-control","/playbook/notifications/channels-and-preferences/marketing-consent"],"sources":["https://eur-lex.europa.eu/eli/dir/2002/58/oj","https://eur-lex.europa.eu/eli/reg/2016/679/oj","https://www.edpb.europa.eu/our-work-tools/our-documents/guidelines/guidelines-22023-technical-scope-art-53-eprivacy-directive_en"]},{"id":"ANA-8","revision":"f372f02c6403","updated":"2026-10-27","name":"Keep personal data out of events","level":"Required","risk":"data","rule":"Never 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.","check":"A query over one day of events finds no `@`, no run of 8 or more digits and no `?` in any property value. The schema test fails on any property of type free string not marked as an ID.","check_type":"command","url":"https://agentwranglers.se/playbook/analytics/privacy-and-consent/events-without-personal-data","related":["/playbook/data-engineering/personal-data-in-the-warehouse/warehouse-pseudonyms","/playbook/operations/logs/logs-without-personal-data"],"sources":["https://eur-lex.europa.eu/eli/reg/2016/679/oj"]},{"id":"ANA-9","revision":"9d40db2d50f5","updated":"2026-10-27","name":"Hide personal data from session recordings","level":"Required","risk":"data","rule":"Session recording and heatmap tools mask every typed value and all text from customer records before anything leaves the browser. They record nothing on payment, sign-in or account settings screens.","check":"A browser test with recording on types the marker `PRIVACY-7f3a` into a form and opens a customer record with a known test name. The captured recording requests contain neither the marker nor the name. Opening the payment and sign-in screens sends 0 recording requests.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/privacy-and-consent/session-recording-privacy","related":["/playbook/website/privacy/processor-agreements","/playbook/website/privacy/cookie-consent","/playbook/operations/logs/logs-without-personal-data"],"sources":["https://eur-lex.europa.eu/eli/reg/2016/679/oj","https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html"]},{"id":"ANA-10","revision":"6ca44ec1bb48","updated":"2026-10-27","name":"Delete raw events on a schedule","level":"Recommended","applies":["eu-users"],"rule":"Keep 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.","check":"A query finds no raw event older than the stated period. The aggregate table still has rows from before it, and none of them hold an ID.","check_type":"command","url":"https://agentwranglers.se/playbook/analytics/privacy-and-consent/analytics-retention","related":["/playbook/data-engineering/personal-data-in-the-warehouse/warehouse-retention","/playbook/data/personal-data/retention-jobs","/playbook/compliance/records-and-data-map/retention-schedule"],"sources":["https://eur-lex.europa.eu/eli/reg/2016/679/oj"]},{"id":"ANA-11","revision":"1eefc9af71b6","updated":"2026-10-27","name":"Write the experiment plan before it starts","level":"Recommended","rule":"Before 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.","check":"Every experiment in the registry has a plan row dated before its start, with all five fields. A query finds no experiment ended before its planned sample size except by a guardrail stop.","check_type":"command","url":"https://agentwranglers.se/playbook/analytics/experiments/experiment-plan","related":["/playbook/seo/crawling-and-indexing/ab-testing","/playbook/machine-learning/serving-and-release/model-ab-test","/playbook/analytics/experiments/no-peeking","/playbook/analytics/experiments/guardrail-metrics","/playbook/analytics/experiments/experiment-lawful-basis","/playbook/analytics/experiments/experiment-assignment"],"sources":[]},{"id":"ANA-12","revision":"df292ca64012","updated":"2026-10-27","name":"Assign each user to one variant for good","level":"Recommended","rule":"Assign 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.","check":"A unit test assigns the same user 1000 times and gets one variant. A test over 100 000 fake IDs gets a 50/50 split within 1 percent.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/experiments/experiment-assignment","related":["/playbook/analytics/experiments/experiment-plan","/playbook/analytics/experiments/sample-ratio-mismatch","/playbook/engineering/running-in-production/deploy-is-not-release","/playbook/analytics/experiments/holdout-groups"],"sources":[]},{"id":"ANA-13","revision":"6613d4d78070","updated":"2026-10-27","name":"Stop the analysis on a sample ratio mismatch","level":"Recommended","rule":"Before reading any result, compare the number of exposed users in each variant with the planned split. When a chi-square test gives p below 0.001, treat the results as void and find the cause.","check":"A unit test feeds the check 50,000 and 48,500 for a planned 50/50 split, and the analysis stops with a sample ratio mismatch. With 50,000 and 49,800, it goes on.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/experiments/sample-ratio-mismatch","related":["/playbook/analytics/experiments/experiment-assignment"],"sources":[]},{"id":"ANA-14","revision":"fef39f079c09","updated":"2026-10-27","name":"Decide only at the planned sample size or with a sequential test","level":"Recommended","rule":"Read the result of a fixed-size test only when it reaches its planned sample size. When the team must look earlier, use a sequential test built for repeated looks, and name it in the plan.","check":"The registry shows, for every finished experiment, either a decision dated on or after the planned stop date or a named sequential method. A query finds no experiment called a win before its planned size with a fixed-size method.","check_type":"command","url":"https://agentwranglers.se/playbook/analytics/experiments/no-peeking","related":["/playbook/analytics/experiments/experiment-plan","/playbook/analytics/experiments/guardrail-metrics"],"sources":[]},{"id":"ANA-15","revision":"e9a546c6f45e","updated":"2026-10-27","name":"Stop an experiment when a guardrail metric breaks","level":"Recommended","rule":"Give every experiment at least two guardrail metrics, such as errors, page speed, refunds or unsubscribes, each with a threshold. Check them daily and stop the variant that crosses one.","check":"Every experiment in the registry lists at least two guardrails with thresholds. On staging, force errors in the treatment so one guardrail crosses its threshold. The daily check turns the variant off and alerts the owner.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/experiments/guardrail-metrics","related":["/playbook/analytics/experiments/experiment-plan","/playbook/analytics/experiments/no-peeking","/playbook/analytics/events-and-metrics/metric-definitions","/playbook/engineering/running-in-production/deploy-is-not-release"],"sources":[]},{"id":"ANA-16","revision":"cb8dd2730e61","updated":"2026-10-27","name":"Keep a holdout group to measure the sum of changes","level":"Optional","rule":"Keep a small share of users, such as 5 percent, on the product as it was at the start of the quarter. At the quarter's end, compare them with everyone else on the primary business metric.","check":"The assignment code puts the holdout's users in no other experiment. A test assigns 100,000 fake IDs and finds the holdout within 0.5 percentage points of its planned share.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/experiments/holdout-groups","related":["/playbook/analytics/experiments/experiment-assignment"],"sources":[]},{"id":"ANA-17","revision":"8bb9ff84c88c","updated":"2026-10-27","name":"Name the lawful basis for every experiment","level":"Required","risk":"law","applies":["eu-users"],"region":["EU"],"rule":"Record the GDPR lawful basis for each experiment before it starts, and ask for consent before storing an experiment ID on the device. Screen tests that change prices, credit, health or content for children for a data protection impact assessment.","check":"Every experiment in the registry has a lawful basis and, for legitimate interest, a link to its balancing test. A browser test with a fresh profile and no consent finds no experiment ID in cookies or storage.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/experiments/experiment-lawful-basis","related":["/playbook/analytics/experiments/experiment-plan","/playbook/compliance/records-and-data-map/legitimate-interests-assessment","/playbook/compliance/records-and-data-map/dpia-screening","/playbook/compliance/records-and-data-map/data-map"],"sources":["https://eur-lex.europa.eu/eli/reg/2016/679/oj","https://www.edpb.europa.eu/our-work-tools/our-documents/guidelines/guidelines-22023-technical-scope-art-53-eprivacy-directive_en"]},{"id":"ANA-18","revision":"02605a565b49","updated":"2026-10-27","name":"Testing prices or targeting vulnerable people in experiments","level":"Avoid","rule":"Never show two people different prices for the same thing in an A/B test. Leave minors and customers flagged as vulnerable out of every experiment.","check":"A test of the assignment code finds no experiment whose variants change a price field. An account flagged as vulnerable or under 18 always gets the control in every running experiment.","check_type":"manual","url":"https://agentwranglers.se/playbook/analytics/experiments/no-price-or-vulnerable-tests","related":["/playbook/ecommerce/catalog-and-prices/personalised-price-notice","/playbook/customer-support/callers-staff-and-tools/vulnerable-customers","/playbook/ecommerce/promotions-and-claims/no-fake-reviews"],"sources":["https://eur-lex.europa.eu/eli/dir/2011/83/oj","https://eur-lex.europa.eu/eli/dir/2005/29/oj"]}]}