Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
In events 2.0, add support for data attributes for automatic tracking #184
In the current pageview script, you can detect page load and history state change. I propose to attach an event on anything that has a data attribute on it. This way you can add it too links or buttons as a data attribute, and have the SA event be called automatically.
This makes a lot of sense in static site generators that spit out HTML. For me to add JS and track these events feels like something we can automate.
So ideally I could do
Not sure if this could be done where it does not collide with existing events and hrefs. Maybe record hrefs and prevent the default. When clicked, call the stored href? Not sure how you handle Angular, Vue, Svelte and React client site SPA nav.