Data Action Listeners is a feature of SlideRule Analytics' GA4 integration that allows Shopify dvelopers and designers to easily track user interactions with HTML elements directly from code using data attributes.
data-action="click"
.data-action="view"
enter the user's browser window.Click Tracking:
View Tracking:
The following attributes are tracked by default for both click and view events:
and all aria elements
Any data-attribute will also be tracked. For instance
data-my-label="my button"
will be tracked as
my_label = "my button"
You can customize the event name in two ways:
data-object="style"
would result in an event name of style_click
.data-event-name="style selection"
would result in an event name of style_selection
.Note in both cases you still need the data-action="click" attribute.
Per Google Analytics 4 naming conventions all property names are snake cased.
All property values values are lower cased to avoid unintentionally duplicated values.
Make sure you observe GA4 collection limits.
In particular:
Make sure you do not send personally identifiable information to GA4.