Sorry, we don't support your browser.  Install a modern browser

Custom event tracking with HTML data attributes

As an alternative to custom event tracking with CSS names, I suggest adding an alternative with HTML data attributes for a better readability. Especially if you use tailwindcss where one can use a lot of css class names, it can be hard to read if you have custom css class names for plausible’s event tracking. Additionally if you have a lot of spaces, then the readability can suffer.

Current solution

<button class="plausible-event-name=my+custom+event">Click</button>

Suggestion with data attribute

<button data-plausible-event-name="my custom event">Click</button>
21 days ago

Fair point. For us, using data-attributes was the first instict for building the tagged-events extension as well. However, we found that many CMS platforms, most notably Wordpress, don’t work very well with data-attributes. So we went with class names because it’s much easier to manipulate them on variety of platforms.

20 days ago