Skip to content

Posthog webview experiments - #2890

Open
mwvolo wants to merge 18 commits into
mainfrom
posthog-webview-experiments
Open

Posthog webview experiments#2890
mwvolo wants to merge 18 commits into
mainfrom
posthog-webview-experiments

Conversation

@mwvolo

@mwvolo mwvolo commented Jun 13, 2026

Copy link
Copy Markdown
Member

This pull request introduces comprehensive integration with PostHog analytics throughout the application, enabling detailed event tracking, user identification, and feature flag-driven UI experimentation. The changes include a new helper module for PostHog, event capture on key user actions, user identification management, and feature flag usage for conditional UI rendering, especially in navigation menus.

Analytics Integration and Event Tracking:

  • Added a new posthog.ts helper module with utility functions for capturing events, identifying users, registering properties, and reading feature flags; includes a custom React hook for flag-driven UI updates.
  • Instrumented key user actions with captureEvent calls:
    • Book selection/deselection in BookSelector (book_selected) [1] [2] [3] [4]
    • Book search actions in SearchBar (book_search_performed) [1] [2] [3]
    • Gated content dialog views and submissions (gated_content_viewed, gated_content_form_submitted) [1] [2] [3]
    • Contact form submissions (contact_form_submitted) [1] [2] [3]
    • Donation initiation (donation_initiated) [1] [2]

User Identification and Cohort Tagging:

  • Automatically identifies and resets the user in PostHog on login/logout via a new PostHogUserIdentifier component in the application shell.
  • Registers CMS-driven cohort properties (e.g., streamlined_nav) on all subsequent events for funnel analysis, using feature flags from the shared data context. [1] [2]

Feature Flag-Driven UI Experiments:

  • Navigation menus now use PostHog feature flags to control the visibility and labeling of menu items, supporting A/B tests and gradual rollouts. This includes:
    • Passing feature flag values to menu item components to conditionally render or relabel nodes [1] [2]
    • New utility functions for flag-aware menu items and label swapping, e.g., for the "Products/Tools" dropdown

These changes lay the groundwork for robust analytics, experimentation, and user segmentation across the application.

This comment was marked as duplicate.

mwvolo and others added 2 commits June 17, 2026 00:52
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mwvolo mwvolo added the wip label Jun 22, 2026
@mwvolo mwvolo closed this Jun 30, 2026
@mwvolo mwvolo reopened this Jul 1, 2026
mwvolo and others added 3 commits July 1, 2026 16:34
…ion events

The k12 top-level nav A/B is no longer needed now that streamlined_nav
shipped as a CMS flag. Register streamlined_nav as a PostHog super
property so any funnel can be sliced by cohort without new events, and
capture the 11 conversion events (PDF downloads, donations, forms,
search, resource access) via the existing lightweight captureEvent()
helper rather than installing the posthog-js SDK, which would have
double-initialized PostHog alongside the GTM-loaded instance.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot finished work on behalf of mwvolo July 9, 2026 20:22
@mwvolo

mwvolo commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

…iments

# Conflicts:
#	test/src/contexts/streamlined-nav.test.tsx

Co-authored-by: mwvolo <3905516+mwvolo@users.noreply.github.com>

Copilot AI commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in commit e03cc92. The only conflict was test/src/contexts/streamlined-nav.test.tsx, which was deleted in main — I accepted that deletion to complete the merge.

Co-authored-by: mwvolo <3905516+mwvolo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants