Skip to content

Comments

Add location to events logged by promptOnNavigate#8550

Merged
matthinz merged 2 commits intomainfrom
matthinz/onbeforeunload-logging-followup
Jun 9, 2023
Merged

Add location to events logged by promptOnNavigate#8550
matthinz merged 2 commits intomainfrom
matthinz/onbeforeunload-logging-followup

Conversation

@matthinz
Copy link
Contributor

@matthinz matthinz commented Jun 7, 2023

In #8512 I added some analytics to our onbeforeunload handlers. Unfortunately, I neglected to augment the events to say where they were actually occurring (path is always set to /api/logger for frontend events--I investigated fixing this for frontend events but it's a bigger lift than I'm looking for ATM).

This PR just augments analytics events related to onbeforeunload with a location parameter (which defaults to location.pathname).

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

I might worry about some naming consistency here, specifically:

  • We use location as a way to describe a source element on the page from which a redirect event is initiated, which is a different type of value from a URL path (source)
  • In another place where we track a similar value, we call it path (source)

Maybe calling it path instead?

@matthinz matthinz force-pushed the matthinz/onbeforeunload-logging-followup branch from bdba3c4 to 9909541 Compare June 8, 2023 22:03
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

LGTM 👍

matthinz added 2 commits June 9, 2023 09:00
Include _where_ the user was when they encountered an onbeforeunload popup.

[skip changelog]
"location" is used more in the sense of "where on the page was this thing."

Also, since we're not actually passing it as an option (or testing that), just always use window.location.pathname.
@matthinz matthinz force-pushed the matthinz/onbeforeunload-logging-followup branch from 9909541 to b4632cc Compare June 9, 2023 16:01
@matthinz matthinz merged commit 5a93c37 into main Jun 9, 2023
@matthinz matthinz deleted the matthinz/onbeforeunload-logging-followup branch June 9, 2023 18:20
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.

3 participants