-
Notifications
You must be signed in to change notification settings - Fork 222
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
ISSUE-1368 Pass clicked element to dynamic context functions for button click tracking plugin #1389
Conversation
…lugin-button-click-tracking to fully enable dynamic contexts in button clicks
Thanks for your pull request. Is this your first contribution to a Snowplow open source project? Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://docs.snowplowanalytics.com/docs/contributing/contributor-license-agreement/ to learn more and sign. Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks. |
I signed it |
Confirmed! @irenehakes has signed the Contributor License Agreement. Thanks so much. |
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.
LGTM!
It's unfortunate we couldn't fit this into v4 as a breaking change, the resulting API inconsistency with the other plugins will be a bit awkward to resolve now.
Plugin | Context Arg 1 | Context Arg 2 | Context Arg 3 |
---|---|---|---|
Button | Event Payload | - (Element in this PR) | - |
Link | Element | - | - |
Form (Change/Focus) | Element | Element Type | Element Value |
Form (Submit) | Element | ElementData[] |
- |
It might be worth planning for v5 to unify plugins onto a single object param for dynamic contexts so we can be a bit looser with the interface. For Link and Button at least, getting the actual MouseEvent/PointerEvent for information on the type of click, modifier keys, coordinates, pressure used, etc could be useful in some use cases (as suggested in #1368) so would be nice to add in at some point.
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.
LGTM, thank you for the contribution @irenehakes!
May I just ask you to add the attached change file to the PR? You can add it at the location:
common/changes/@snowplow/browser-plugin-button-click-tracking/issue-1368_2024-11-22-08-27.json
Good point, @jethron! Have made an issue for the unification in v5, #1390
@matus-tomlein I just pushed up that change file. Let me know if there's anything else. |
BundleMonFiles added (6)
Total files change +105.54KB 0% Final result: ✅ View report in BundleMon website ➡️ |
Relates to Issue 1368
The button click tracking plugin appears to have an undocumented feature for attaching dynamic contexts to each button click, similar to link click tracking plugin.
The button click tracking plugin's dynamic context function, however, only takes the button click event as an argument. This PR updates this call to also pass in the clicked element.