Add documentation for GA4 tracking#3014
Conversation
hezzimo
left a comment
There was a problem hiding this comment.
Just a couple of queries
|
|
||
| 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). | ||
|
|
||
| Via this means we are tracking: |
There was a problem hiding this comment.
This list is helpful. Might just be my addled 🧠 😄 but I wonder if this could be clearer if it read 'Via GA4 we are tracking':?
| - 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. | ||
|
|
||
| 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. | ||
|
|
There was a problem hiding this comment.
This might be irrelevant but did you mention having to prevent a form from submitting at some point, in order to see the tracking fully? Just wondered if it would be worth adding that info here?
There was a problem hiding this comment.
Yes, that's kind of an alternative to setting "Preserve log" in the console, and probably a better one because it means you can observe what data gets sent without actually saving. I've put that instead and also update the reference to the dataLayer later in a way that makes more sense in that context.
- Add reference to doc in README - Add tracking doc
- Make text change for clarity - Replace reference to "Preserve log" with disabling the form submission
94ffe21 to
ca89f6a
Compare
This adds some documentation for the GA4 tracking work on Publisher. It is a work in progress: it covers what has been added so far and will expand as more features are added. Most usefully it covers how to test the work locally in a section that can be referenced in future PRs.