Create a generic event listener for tracking clicks on GitLab.com
Problem to solve
We use Snowplow for event tracking. Snowplow's built-in method is to attach listeners to every <a href>
on a page after load, but we want to selectively apply listeners to events in order to manage page performance and ensure we're tracking only what we need.
Proposal
We should create a generic JS function that we can apply to whatever events we determine are important.
New file stats.js
that can be imported with a function trackEvent(category, eventName, { additionalData })
that function then needs to determine if by example Snowplow is activated and loaded and send then this data to Snowplow, later we can also add support for the other statistic packages if needed.
What does success look like, and how can we measure that?
- We have a generic JS function we can apply to any event we'd like to track across GitLab.com.
- Other teams can pick up this function and easily use it to track events in their respective product categories.
Links / references
Edited by Tim Zallmann