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

Pass clicked element to dynamic context functions for button click tracking plugin #1368

Closed
andrewlangston opened this issue Oct 28, 2024 · 3 comments
Labels
type:enhancement New features or improvements to existing features.

Comments

@andrewlangston
Copy link

Is your feature request related to a problem? Please describe.
But button click tracking plugin appears to have an undocumented (at least on docs.snowplow.io: https://docs.snowplow.io/docs/collecting-data/collecting-from-own-applications/javascript-trackers/web-tracker/tracking-events/button-click/) feature for attaching dynamic contexts to each button click, similar to the link click tracking plugin.

However, the button click tracking plugin's dynamic context functions take only the button click event as an argument: https://github.com/snowplow/snowplow-javascript-tracker/blob/master/plugins/browser-plugin-button-click-tracking/src/api.ts#L105. This is less flexible than the link click tracking plugin's ability to take the clicked element as an argument to dynamic context functions: https://github.com/snowplow/snowplow-javascript-tracker/blob/master/plugins/browser-plugin-link-click-tracking/src/index.ts#L279

Describe the solution you'd like

  1. Update the button click tracking plugin to pass the click element (rather than the button click event) to dynamic context functions
  2. Document this feature on docs.snowplow.io

Describe alternatives you've considered
N/A

Additional context
N/A

@andrewlangston andrewlangston added the type:enhancement New features or improvements to existing features. label Oct 28, 2024
@matus-tomlein
Copy link
Contributor

Hi @andrewlangston, thanks for the feature request, that makes sense!

Hopefully we can make this a non-breaking change – I was thinking that we could add the button element as the second argument in the callback, after the event.

@andrewlangston
Copy link
Author

@matus-tomlein good call, makes sense!

@irenehakes
Copy link
Contributor

I've submitted a PR with the change here

When that's released, where is the right place to update documentation? Is it https://github.com/snowplow/documentation/blob/main/docs/collecting-data/collecting-from-own-applications/javascript-trackers/web-tracker/tracking-events/button-click/index.md?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New features or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

3 participants