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

In events 2.0, add support for data attributes for automatic tracking #184

Open
simpleanalyticsbot opened this issue Dec 10, 2019 · 1 comment

Comments

@simpleanalyticsbot
Copy link
Collaborator

@simpleanalyticsbot simpleanalyticsbot commented Dec 10, 2019

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 <button data-sa-event="signup"/>

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.

@simpleanalyticsbot simpleanalyticsbot added this to Features & bugs in Public roadmap via automation Dec 10, 2019
@adriaanvanrossum

This comment has been minimized.

Copy link
Contributor

@adriaanvanrossum adriaanvanrossum commented Dec 11, 2019

This seems a great UX for events! As we are updating our JS, we should look at this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Public roadmap
  
Features & bugs
2 participants
You can’t perform that action at this time.