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

[WNMGDS-3205] Adds analytics tracking to theme & version dialogs #3424

Merged

Conversation

tamara-corbalt
Copy link
Collaborator

@tamara-corbalt tamara-corbalt commented Feb 4, 2025

Summary

  • Introduces a new analytics utility, sendFilterAppliedEvent and integrates it into the theme and version switcher dialogs on the docsite.

Jira ticket

How to test

  • Spin up the local server: npm run start
  • Open http://localhost:8000/
  • In the JavaScript console, execute window.utag.link = console.log to be able to intercept the analytics events and see them printed to the console.
  • In your console settings, enable the preserving of logs between navigation requests. We'll be performing actions that both send analytics and go to a new page, so we don't want the page refresh to clear the console before we can see the event printed
  • Try switching themes or versions.
    • For switching versions you should see something like this:
      Screenshot 2025-02-04 at 3 28 36 PM

    • For switching themes you should see something like this:

    Screenshot 2025-02-04 at 3 26 22 PM

Checklist

  • Prefixed the PR title with the Jira ticket number as [WNMGDS-####] Title or [NO-TICKET] if this is unticketed work.
  • Selected appropriate Type (only one) label for this PR, if it is a breaking change, label should only be Type: Breaking
  • Selected appropriate Impacts, multiple can be selected.
  • Selected appropriate release milestone

@tamara-corbalt tamara-corbalt added Impacts: Documentation Indicates that this item relates to documentation Type: Added Indicates a new feature. labels Feb 4, 2025
@tamara-corbalt tamara-corbalt added this to the 12.1.0 milestone Feb 4, 2025
@tamara-corbalt tamara-corbalt changed the title [WNMGDS-3205] Add analytics to theme & version dialogs [WNMGDS-3205] Adds analytics tracking to theme & version dialogs Feb 4, 2025
@tamara-corbalt tamara-corbalt marked this pull request as ready for review February 4, 2025 20:36
@@ -15,6 +16,11 @@ export const ThemeVersionDialog = (props: ThemeVersionDialogProps) => {

function handleUpdate() {
if (version !== props.version) {
let filterCategoriesUsed = { theme: props.theme, version: version };
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is super close! In trying this out, there's one case that we won't capture which is if people select the latest version from the dropdown. We know that the latest version is the one shown by default, but users might not get that, and it could be helpful to see when users happen to select the latest version. I think moving these lines outside of the if statement to the beginning of the handle update would be a good way to handle this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I see what you mean. Will update!

@@ -16,6 +17,10 @@ export const ThemeVersionDialog = (props: ThemeVersionDialogProps) => {
function handleUpdate() {
if (theme !== props.theme) {
setQueryParam('theme', theme, true);

let filterCategoriesUsed = { theme: theme };
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we want to move these added lines to outside of the if check. We want to capture when users stay on the currently selected theme. Also, is there a way to derive the version here too? Maybe by looking at the url and by using the getVersionEquivalent function?

Copy link
Collaborator Author

@tamara-corbalt tamara-corbalt Feb 6, 2025

Choose a reason for hiding this comment

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

Love this idea! Instead of deriving the fromVersion argument for getVersionEquivalent from the URL, I think it might make more sense to expand the props on the theme dialog component so that it receives the version prop from the parent—just like the version dialog. Let me know what you think!

Copy link
Collaborator

@kim-cmsds kim-cmsds left a comment

Choose a reason for hiding this comment

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

Pulled this down locally and was able to follow the steps to verify the payload data using the window.utag.link = console.log step

Copy link
Collaborator

@jack-ryan-nava-pbc jack-ryan-nava-pbc left a comment

Choose a reason for hiding this comment

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

👌🏻

@tamara-corbalt tamara-corbalt merged commit 62c7cee into main Feb 7, 2025
1 check passed
@tamara-corbalt tamara-corbalt deleted the tamara/WNMGDS-3205-add-analytics-to-theme-switcher branch February 7, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Impacts: Documentation Indicates that this item relates to documentation Type: Added Indicates a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants