You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ga4-tracking.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Tracking is added to Publisher via GA4. The full documentation is avaialable in [GA4 Publishing Implementation guide](https://docs.google.com/document/d/19RaqZttDTZXsgX4k87wAAOhsol1STM3iTPPPKNlXRl0/edit?tab=t.0#heading=h.eo3rk3rxuz4n).
4
4
5
-
Via this means we are tracking:
5
+
Via GA4 we are tracking:
6
6
- Page views
7
7
- Navigation
8
8
- Form interactions
@@ -13,10 +13,10 @@ Most of the code exists in the govuk_publishing_components gem. On publisher we
13
13
14
14
Tracking can be tested locally with these steps:
15
15
- ensure that the "Ga4 form tracking" feature is set to "On" via FlipFlop
16
-
-ensure that "Preserve log" is set to "On" in the browser console
16
+
-run `document.querySelector('form').addEventListener('submit',function(e){e.preventDefault()})` in the browser console. This will disable form submissions so the full set of data from user interactions can be observed without leaving the page and saving any changes.
17
17
- run `window.GOVUK.analyticsGa4.showDebug = true` in the browser console. The console will then display the tracking data for all user interactions with the form as they occur.
18
18
19
-
Running `window.dataLayer` in the browser console at any point will display the data that has been collected during user interactions with the page. In this work we are interested in the "event_data" events. There should be one of these for each user event with the form since the page was loaded.
19
+
Running `window.dataLayer` in the browser console after performing a save will display the data that has been collected during user interactions with the page. In this work we are interested in the "event_data" events. There should be one of these for each user event with the form since the page was loaded.
0 commit comments