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 ip_override.

Note that the GA4 tag automatically truncates the last octet of the IP address to 0, so setting it to will have the same effect as setting it to

Field nameDescriptionSample value
campaign_contentCampaign Content.my_campaign
campaign_idCampaign ID.cpb12345
campaign_nameCampaign Name.january2023
campaign_sourceCampaign Source.newsletter
client_hints.mobileClient Hints API1 if device is mobile, 0 if not.1
client_hints.platformClient Hints API. Platform name.macOS
client_idGoogle Analytics Client ID.1234567.1234567
engagement_time_msecEngagement Time in milliseconds.1000
ga_session_idGA4 session ID.1680157606
ga_session_numberGA4 session count.4
ip_overrideUser’s IP address.
languageBrowser language.en-us
page_locationPage URL.
page_referrerPage Referrer.
page_titlePage Title.My Home Page
user_agentUser Agent string (gets set in the outgoing request headers).Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36
user_idGA4 User ID.my_crm_id_abc
x-ga-page_idPage ID.my_page_id_11111

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.

Event Data 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 ( 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.

Write a Comment

Your email address will not be published. Required fields are marked *