How to Override Google Analytics 4 Fields in Server-Side GTM
To edit the fields, you need to use the option under Event Parameters labeled Parameters to Add / Edit. This will not work if you try to add the fields under User Properties.
To add or edit a field, consult the list below. The field names are derived from the Event Data object. Not all fields in the Event Data object can be edited.
Take a look at the screenshot above for an example of how to manually set the user’s IP address using the field
Note that the GA4 tag automatically truncates the last octet of the IP address to
0, so setting it to
22.214.171.124will have the same effect as setting it to
|Field name||Description||Sample value|
|Client Hints API. |
|Client Hints API. Platform name.|
|Google Analytics Client ID.|
|Engagement Time in milliseconds.|
|GA4 session ID.|
|GA4 session count.|
|User’s IP address.|
|User Agent string (gets set in the outgoing request headers).|
|GA4 User ID.|
The rule of thumb is that if the field is available in the Event Data object, which you can easily debug in server-side tagging Preview mode, you can override it using the event data key from that object.
However, I found that fields that begin with
x-ga (GA’s own internal settings) cannot be overridden except for the elusive
x-ga-page_id. This means that you can’t set a hit as a First Visit (
x-ga-system_properties.fv) or as a Session Start (
x-ga-system_properties.ss) unless the incoming stream already set those values.
Please let me know in the comments if I missed some fields. I’ll update the list accordingly.