|
5 | 5 | // |
6 | 6 | // CLICK TRACKING |
7 | 7 | // Add `data-matomo-click="Category, Action, Name"` to any element to track |
8 | | -// clicks as Matomo events. The Name segment is optional. We have a convention |
9 | | -// of using semicolons inside Name to divide multiple values. |
| 8 | +// clicks as Matomo events. We have a convention of using semicolons inside Name |
| 9 | +// to divide multiple values. This is purely for consistency. |
10 | 10 | // |
11 | 11 | // This tracking can be placed directly on an interactive element. |
12 | 12 | // Tracking also works if placed on a container. The script will look |
|
16 | 16 | // |
17 | 17 | // Examples: |
18 | 18 | // <a href="/file.pdf" data-matomo-click="Downloads, PDF Click, My Paper">Download</a> |
19 | | -// <button data-matomo-click="Search, Boolean Toggle">AND/OR</button> |
| 19 | +// <button data-matomo-click="Search, Boolean Toggle, Off">AND/OR</button> |
20 | 20 | // |
21 | 21 | // Event delegation on `document` means this works for elements loaded |
22 | 22 | // asynchronously (Turbo frames, content-loader, etc.) without re-binding. |
23 | 23 | // |
24 | 24 | // SEEN TRACKING |
25 | 25 | // Add `data-matomo-seen="Category, Action, Name"` to any element to fire a |
26 | | -// Matomo event when that element becomes visible in the viewport. The Name |
27 | | -// segment is optional. We have a convention of using semicolons inside Name |
28 | | -// to divide multiple values. Each element fires at most once per page load. |
| 26 | +// Matomo event when that element becomes visible in the viewport. We have |
| 27 | +// a convention of using semicolons inside Name to divide multiple values. |
| 28 | +// Each element fires at most once per page load. |
29 | 29 | // Works for elements present on initial page load and for elements injected |
30 | 30 | // later by Turbo frames or async content loaders. |
31 | 31 | // |
32 | 32 | // Examples: |
33 | 33 | // <div data-matomo-seen="Impressions, Result Card, Alma">...</div> |
34 | | -// <a data-matomo-seen="Promotions, Banner Shown">...</a> |
| 34 | +// <a data-matomo-seen="Promotions, Banner Shown, Banner Type">...</a> |
35 | 35 | // |
36 | 36 | // DYNAMIC VALUES |
37 | 37 | // Wrap a helper name in double curly braces anywhere inside a segment to have |
|
0 commit comments