Skip to content

refactor: identify report analytics by the generating machine's anon id - #27

Merged
blimmer merged 1 commit into
mainfrom
refactor/posthog-anon-id-identity
May 27, 2026
Merged

refactor: identify report analytics by the generating machine's anon id#27
blimmer merged 1 commit into
mainfrom
refactor/posthog-anon-id-identity

Conversation

@blimmer

@blimmer blimmer commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

The report's PostHog distinct_id was the per-run reportId, so a run's CLI events (keyed by the machine anon id) and its report views never resolved to the same PostHog person. That broke person-based funnels across the CLI→report boundary and let internal report activity slip past the anon-id "internal" cohort.

This identifies the report by the embedded generatedByAnonId — the same distinct id the CLI already uses — so both surfaces are one person. pw_report_id stays on every event as a property for per-run slicing; the now-redundant pw_generated_by property is dropped. Not backward compatible (fine by design): older reportId-keyed report persons won't merge.

Depends on #26 to actually run the touched analytics suites in CI — will rebase once that lands.

Review focus

The tradeoff of anon-id-as-identity: views of a shared/uploaded report attribute to the generator's anon id rather than grouping per-report. For a diagnostic tool that's arguably more correct, and it's no worse than the prior reportId scheme (which also couldn't tell viewers apart). Falls back to reportId only when no anon id was embedded.

Commits

  • b280b2e — identify report analytics by the generating machine's anon id

@blimmer
blimmer requested a review from jcarver989 as a code owner May 27, 2026 20:29
The report's PostHog distinct id was the per-run reportId, so a run's CLI
events (keyed by the machine anon id) and its report views never resolved to
the same person. That broke person-based funnels across the CLI→report
boundary and let internal report activity slip past the anon-id cohort.

Use the embedded generatedByAnonId as the report's distinct id so both
surfaces share one person. pw_report_id stays on every event as a property
for per-run slicing; the now-redundant pw_generated_by property is dropped.

Not backward compatible: older reportId-keyed report persons won't merge,
which is fine going forward.
@blimmer
blimmer force-pushed the refactor/posthog-anon-id-identity branch from b280b2e to 28ba845 Compare May 27, 2026 20:35
@blimmer
blimmer enabled auto-merge (squash) May 27, 2026 20:36
@blimmer
blimmer merged commit cb17a4f into main May 27, 2026
8 checks passed
@blimmer
blimmer deleted the refactor/posthog-anon-id-identity branch May 27, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant