Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFS-2162: Set up mixpanel and use it to track page views #399

Closed
wants to merge 2 commits into from

Conversation

tdooner
Copy link
Contributor

@tdooner tdooner commented Dec 17, 2024

Ticket

Resolves FFS-2162.

Changes

  • Add MixpanelEventTracker proof of concept

Context for reviewers

This is just an initial implementation. Plans for this PR:

  • Add environment variable to terraform

Plans for a subsequent PR that finishes the NewRelic -> Mixpanel transition:

  • Call mixpanel.identify at some point to associate the distinct_id with the user's device id
  • Use maybe_later gem to move event tracking to happen after the body is sent to the client (for performance)
  • Audit event names to try and ensure consistency of "[subject][action][object]", e.g. "CaseworkerLoggedIn" or "ApplicantDownloadedIncomePDF" where possible.
  • Try and simplify the metric tracking somehow, possibly by moving the tracking methods onto a separate module

Setup instructions:

  1. Engineers will need to get the MIXPANEL_TOKEN value from the shared 1password .env.development.local file.
  2. Engineers will need to create Mixpanel accounts.

Acceptance testing

  • No acceptance testing needed
    • This change will not affect the user experience (bugfix, dependency updates, etc.)
  • Acceptance testing prior to merge
    • This change can be verified visually via screenshots attached below or by sending a link to a local development environment to the acceptance tester
    • Acceptance testing should be done by design for visual changes, product for behavior/logic changes, or both for changes that impact both.
  • Acceptance testing after merge
    • This change is hard to test locally, so we'll test it in the demo environment (deployed automatically after merge.)
    • Make sure to notify the team once this PR is merged so we don't inadvertently deploy the unaccepted change to production. (e.g. :alert: Deploy block! @ffs-eng I just merged PR [#123] and will be doing acceptance testing in demo - please don't deploy until I'm finished!)

This adds a simple MixpanelEventTracker module, comparable to the
NewRelic one.
@tdooner tdooner changed the title FFS-2162: Procure a new metrics platform FFS-2162: Set up mixpanel and use it to track page views Dec 17, 2024
@tdooner tdooner marked this pull request as ready for review December 26, 2024 17:38
url_params = request.params.slice("site_id", "locale")

# Set these attributes as default (global) across all the tracked events.
new(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - I'm not sure why we didn't implement something like this for the NR event tracker.

@tdooner tdooner requested a review from millerti January 2, 2025 21:35
@allthesignals allthesignals force-pushed the td/ffs-2162-procure-new-metrics-platform branch from 1bbca69 to ecb1e31 Compare January 22, 2025 19:30
@millerti millerti marked this pull request as draft January 22, 2025 22:19
@millerti millerti closed this Jan 22, 2025
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.

4 participants