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

web: add additional analytics to toggle ApiButton interactions #5237

Merged
merged 2 commits into from
Dec 1, 2021

Conversation

lizzthabet
Copy link
Contributor

@lizzthabet lizzthabet commented Nov 30, 2021

To prep for the disable resources launch:

  • Add toggleValue property to toggle button analytics to indicate what the value for toggle is when the user clicks on it
  • Add toggle button analytics tags to the confirm/cancel buttons
  • Reorganize and add more types and constants for ApiButton

The toggleValue property will help us know if a user is clicking disable or enable on a resource. I could see this value being potentially confusing because it doesn't represent the value that will result from the user interaction. But because a user could confirm or cancel their toggle, I think it's fine to record the value "pre" toggle.

Here's what a disable resource button click looks like:

{
  "action": "click",
  "buttonType": "DisableToggle",
  "component": "Resource",
  "specHash": "9ac7c2a31917ba7ca7ca",
  "toggleValue": "on"
}

and a confirmation button click:

{
  "action": "click",
  "confirm": "true",
  "buttonType": "DisableToggle",
  "component": "Resource",
  "specHash": "9ac7c2a31917ba7ca7ca",
  "toggleValue": "on"
}

A cancel button click will have confirm: "false", but otherwise look the same as above.

Will link a related pr for the schema documentation shortly!

Closes CH13015.

@lizzthabet lizzthabet self-assigned this Nov 30, 2021
@lizzthabet lizzthabet changed the title web: add additional analytics to toggle ApiButton interactions web: add additional analytics to toggle ApiButton interactions Nov 30, 2021
@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #13015: (non-launch blocker) Analytics test.

web/src/ApiButton.tsx Outdated Show resolved Hide resolved
@lizzthabet lizzthabet force-pushed the lizz/chore/disable-resources-analytics branch from 5a8d69f to f69d270 Compare November 30, 2021 21:52
}

return {
buttonType,
Copy link
Member

Choose a reason for hiding this comment

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

would it be better to leave off the tag completely if it's not defined, like the original code did? otherwise, i think you might end up with a bunch of {tag: "undefined"} in analytics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's a great question! i believe that serializing to json drops properties that are undefined (JSON.parse(JSON.stringify(tags)) does), but i'm not 100% sure of that. it's probably faster for me to make the code change than test my assumption out.

if anyone else knows, lmk for my curiosity. 🕵🏻‍♂️

@lizzthabet lizzthabet merged commit da32d75 into master Dec 1, 2021
@lizzthabet lizzthabet deleted the lizz/chore/disable-resources-analytics branch December 1, 2021 22:54
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.

None yet

2 participants