Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Reporting: Track events for
View report
links on Payment activity widget #8687Reporting: Track events for
View report
links on Payment activity widget #8687Changes from 8 commits
ad3fc2c
7394807
9293aff
4c050df
4358ef9
21d36a0
5454bc2
4a346a7
922feb8
bf77f83
ed37a77
33317bc
5069046
3d5a2d1
019f8cd
5c5da5b
fd6b1c8
83a690e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do we need the
source
parameter (I'm assuming it's optional)? I think this is used to distinguish generic events by the originating high-level component or container. How do other WooPayments events usesource
?In this case we have unique events for each click target, so
source
is redundant.An alternative design would be to use a generic event name, and distinguish which box using source:
wcpay_overview_payment_activity_click
total_payment_volume
The question is whether we'd want to aggregate any click on the activity widget. If so, a common event is useful. If not, unique event for each thing works well.
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.
The idea of using a common event for the tile is fantastic, and makes things totally clean! Thanks for opening my eyes to this possibility! Also a great note for me "Is this a good enough reason to pass a callback?" . Clearly no in this case with the alternative you suggested :D .
I have implemented a common click event, and a source that is extrapolated from the existing
label
prop. ( make it all small case and replace spaces with underscores, where needed)I hope I have done it appropriately here : 5069046
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.
Looks good!
I'd suggest using an explicit
source
value for each tile, rather than generating from label. This is one more prop (tracksSource
?), but it's simple and explicit, and allows future tracks investigators to search the code for the source value to work out where it's getting fired.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.
I have added an explicit
tracksSource
prop here - 5c5da5b . Thanks!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.
Is our
PaymentDataTile
abstraction helping here? If we expose a prop for every detail of it, we might be better off just usingLink
directly in the outer markup.Alternatively, if we are ok using the same event name for all tiles e.g.
wcpay_overview_payment_tile_click
, the component could abstract away the tracking behaviour nicely. It could use an existing prop or expose atracksEventSource
prop, which would avoid complex callback interface.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.
Explained in the earlier comment.
#8687 (comment)
Thanks!