-
Notifications
You must be signed in to change notification settings - Fork 108
Add meganav Google Analytics tracking for user interactions on mobile #2022
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2022 +/- ##
=======================================
Coverage 76.70% 76.70%
=======================================
Files 16 16
Lines 1588 1588
=======================================
Hits 1218 1218
Misses 370 370
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
75efe19 to
86b0625
Compare
f57a7ac to
45f2d0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Google Analytics tracking for mobile navigation interactions by introducing a new mobile-specific tracking module that mirrors the existing desktop tracking functionality. The implementation captures user interactions with the mobile navigation menu, including menu opens/closes, back button clicks, section toggles, and external link clicks.
Key Changes:
- Extracted common tracking utilities into a shared module to eliminate code duplication
- Implemented comprehensive mobile navigation tracking with event data pushed to Google Analytics dataLayer
- Integrated mobile tracking initialization into the main GA tracking entry point
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| static/js/navigation/utils.js | New shared utility module containing common functions for both desktop and mobile tracking |
| static/js/navigation/meganav-tracking.js | Refactored to import shared utilities instead of duplicating code |
| static/js/navigation/meganav-tracking-mobile.js | New module implementing mobile-specific navigation tracking handlers and event builders |
| static/js/navigation/ga-tracking.js | Updated to initialize mobile tracking alongside desktop tracking |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
45f2d0a to
340b34a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
d1835bf to
fb30fbc
Compare
5fd4fc6 to
6861251
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
7952b73 to
e438ece
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR @Onibenjo! LGTM!
I only got one code suggestion, and one potential testing suggestion.
|
Given the fact this entire work revolves around using selectors (including heavily relying on class names), if any element is changed or modified as a result of copy updates, page refreshes or nav revamps, some parts of the tracking will start failing silently. I believe this makes it a good candidate of our testing stories, and should be automated with tests (maybe playwright) to perform actions, and compare datalayer results with expected outcomes. |
add media query listener to handle breakpoint changes and cleanup event listeners move search tracking to separate module and add cleanup functions for both desktop and mobile tracking
87c75eb to
2bd724c
Compare
@muhammad-ali-pk Edit: |
For us to be able to track how people use the navigation reliably, we need that information to be supplied by the web app into the dataLayer.
The goal is to send information into the dataLayer if a user interacts with the navigation on mobile.
Done
QA
Issue / Card
Fixes # https://warthogs.atlassian.net/browse/WD-30163
Screenshots
[if relevant, include a screenshot]