Priority: Should have
Affects Version/s: None
Fix Version/s: 2.30.1
Sprint:Sprint #131, Sprint #132
P4 site:All sites
P4 Test Environment:mars
Last year we started tracking a few click events on selected Planet 4 sites via Google Tag Manager, often based on the element's IDs or classes. This usually demands an extensive custom setup in Tag Manager and is often less accurate.
As suggested by Pieter Vincent and Sagar Deshmukh, we can work with data-* attributes instead of dataLayer events. This should facilitate the implementation while also allowing some more flexibility when setting up the events tags in Google Tag Manager.
The idea is to implement a set of new data attributes with standard values. These will be used later to trigger events and define its category, action and label.
- Example: See image attached for using GTM's dataLayer variable to extract data attributes (gtm.element.dataset.target)**
Investigate approach of using data-attributesdone Investigate approach of using a Twig template to be used for all the eventssee below
- Implement data-attributes on elements:
- Implement data-attributes with the following standard values:
|Footer Navigation||Primary Links
- Investigate and communicate with NROs using child themes to apply the same data attributes
Here are the screenshot linking the elements with the data-ga-action standard value:
To view all events standards and data-attributes structure proposed: "P4 Events Standards - 2020 Review"
Julia's summary: For event tracking, we should use the Universal Analytics (GA) tag which is natively supported by Google Tag Manager. This means that the custom templates are not the best direct solution, since they are designed to add custom (and reusable) tags that are not supported by default.
Julia should create the Google Tag Manager setup in all P4-NRO's containers.