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

Add OTB Button Click Tracking (close #1267) #1269

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

greg-el
Copy link
Contributor

@greg-el greg-el commented Nov 24, 2023

This PR adds a plugin for automatic button click tracking, similar to the existing link click tracking.

It provides a single method, enableButtonClickTracking. Which accepts a couple of options:

enableButtonClickTracking.filter

This allows the user to provide either an allowlist, denylist, or a custom callback, that will only track a click if the element that has been clicked on passes the filter, for example of a function filter that will accept the following button:

<button id="my-cool-button">Click Here</button>
filter: (elem: HtmlElement) => elem.id === "my-cool-button")

enableButtonClickTracking.context

Allows attaching a dynamic entity to the button click events.

note: The integration tests won't pass on CI, as the button click schema isn't on Iglu Central yet (see snowplow/iglu-central@master...release/r150)

@snowplowcla snowplowcla added the cla:yes [Auto generated] Snowplow Contributor License Agreement has been signed. label Nov 24, 2023
Copy link

bundlemon bot commented Nov 24, 2023

BundleMon

Files added (6)
Status Path Size Limits
libraries/browser-tracker-core/dist/index.mod
ule.js
+25.6KB 26KB / +10%
trackers/javascript-tracker/dist/sp.js
+24.73KB 25KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+15.04KB 15.5KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+14.91KB 15KB / +10%
libraries/tracker-core/dist/index.module.js
+13.36KB 15KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.51KB 5KB / +10%

Total files change +97.15KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

Copy link
Contributor

@matus-tomlein matus-tomlein left a comment

Choose a reason for hiding this comment

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

Very nice implementation, great work! 👍

Copy link
Contributor

@matus-tomlein matus-tomlein left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@greg-el greg-el force-pushed the issue/1267-otb-button-click-tracking branch from 24eb26f to fe51795 Compare November 28, 2023 13:43
@greg-el greg-el merged commit b1c3366 into release/3.18.0 Nov 28, 2023
1 of 2 checks passed
@greg-el greg-el mentioned this pull request Dec 4, 2023
@greg-el greg-el deleted the issue/1267-otb-button-click-tracking branch August 9, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes [Auto generated] Snowplow Contributor License Agreement has been signed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants