I'm using the Measurement Protocol to push e-commerce events to GA4 and it works well. The screenshot shows an example of the data I'm passing from the backend.
Additionally, I'd like to pass host_name
parameter, however, looking through the official documentation I didn't find any information on support for it. Is there a way to pass this as well?
In the case of the Measurement Protocol for Universal Analytics, hostname can be passed by declaring it as dh
(eg: 'dh' => 'www.domain.com'
), but this does not work with GA4.
Appreciate any help, thanks.
Please have a look at this document API Dimensions & Metrics,
Depending on your requirements you may use fullPageUrl
which is a dimension that returns the host-name, page path, and query string for web pages visited.
Or you can use page_location
Automatically collected events. Just remember that if you want to use page_location you should create customised dimension named exactly page_location.
In order to create custom dimension (Creating Custom Dimension and Metric), log into your analytics.google account and then
Event
.This tutorial also explains about how to See Full Page URLs in Google Analytics 4.