Open ashkart opened 7 years ago
@ashkart You can just call setUserAgentOverride
method on the Analytics object.
@jorgeborges, thats what i talking about - it seems dat setter doesnt affect on its target parameter in analytics. Even i set any value with setUserAgentOverride(), i always get 'THE ICONIC GA Measurement Protocol PHP Client (https://github.com/theiconic/php-ga-measurement-protocol)' in my analytics reports in "Browser" metric.
The reason may be google prefers to use header "User-Agent" value.
This is the way Google provides to override the User-Agent. Other users reported this before and they used it successfully. See here: https://github.com/theiconic/php-ga-measurement-protocol/issues/4
$analytics->setUserAgentOverride('My Custom User-Agent');
More info from the official docs in: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ua
user agent is always value of const PHP_GA_MEASUREMENT_PROTOCOL_USER_AGENT, which isnt informative for any analytics at all.
Its hardcoded in HttpClient class with no chanse to actually override without of library code changing: