br33f / php-GA4-Measurement-Protocol

PHP GoogleAnalytics4 Measurement Protocol Library
88 stars 19 forks source link

Missing user agent, device category "(not set)" #36

Open Romanavr opened 1 year ago

Romanavr commented 1 year ago

I have a problem using this library. For some reason, the user agent is always missing in GA4, so the device category in the report is always "(not set)" изображение I didn’t have such problems with UA, so I’m wondering what could be wrong? From similar issues https://github.com/br33f/php-GA4-Measurement-Protocol/issues/8 and https://github.com/br33f/php-GA4-Measurement-Protocol/issues/29 I can see that right now there is no way to override UserAgent. Therefore, I have a question, perhaps someone has encountered such a problem and found a way to fix it? I would appreciate any help and food for thought.

Fnizou commented 1 year ago

Hi, I have Open similar issue #37 I will try to add these values :

Romanavr commented 1 year ago

Hi, I have Open similar issue #37 I will try to add these values : - User Agent Override - Screen Resolution - Viewport size https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#sr I'll let it run for 24 hours and I'll come back to you

I really appreciate it, thanks!

Fnizou commented 1 year ago

Outch, in Doc GA4

User Agent Override There is no way to override the user agent in GA4. https://developers.google.com/analytics/devguides/collection/protocol/ga4/ua-feature-matrix#user_agent_override

System Information UA has optional parameters for system information like screen resolution, viewport size, and more.

In GA4, many of these parameters are automatically collected by the Google Tag (gtag) while others have been deprecated like Flash version. If you want to continue to collect this data, you need to create custom events and parameters.