Repository navigation
Tracker: count a tagged form once per submission - #231
Conversation
A click on a submit button bubbled up to the tagged form and fired the event, then the submit event fired it again. Click handling now stops at a form and leaves it, and any tagged ancestor, to the submit event. Tagged buttons inside forms still count on click.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
A form tagged with
data-supermetry-event(or asupermetry-event-*class) was counted twice per submission: the click on its submit button bubbled up to the form and fired the event, and thesubmitevent fired it again. A tagged element wrapping a form had the same problem.Fix
tracker.extensions.js(full bundle) andtracker.clicks.js(per-site script): while handling a click, the handler stops walking up the DOM when it reaches a<form>, leaving the form and its tagged ancestors to the submit event. A tagged button inside a form still counts on click. The minified bundles are regenerated.Tests
tracker_runtime_test.js: a tagged form and a tagged wrapper around a form each count once per click + submit, in both the full build andtracker.clicks.js. A tagged button inside a form counts once.modulesoption for loading the per-site scripts.node tracker_runtime_test.js,go test ./internal/tracker/ ./internal/api/...,go vetall pass.