aawnu / php-ga4

PHP Wrapper for Google Analytics 4 with Server Side Tracking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Server only tracking, user tracking?

manuelcoders opened this issue · comments

I implemented tracking on a new property that tracks servers ONLY.

I see the pageviews correctly, but I don't see the users.
It's as if the events were not launched by users and therefore I can't understand their behavior, they all seem to be unconnected events.

I call the library and set setClientId to a unique value for each user.

Am I doing something wrong or is it not possible to have the concept of user by tracking only servers?

Not sure if what you're asking is the part covered by the "dataflow" section in the Readme. Please let me know.

Hi aawnu, yes I read the README but I didn't understand if it works by just doing a server tracing. I don't do anything with "gtag.js". Probably without using gtag on GA4 then some information is missing to correctly create the user session, right?

Sorry! Never got back to you.

GTAG.js will send the "first visit" action that starts a session. You should still be able to track everything, but I am not sure how well/accurate of a session you will get if using custom ids.

Hi aawnu, thanks for the reply!

Shouldn't 'first visit' be called only and exclusively the first time a user browses the site? I'm having a bit of trouble managing this server side thing...

Are you saying that I should also send session_start for subsequent sessions?
Do you know anyone who has tried to do full server tracking with GA4?

I am not sure it is entirely possible to run a fully server-side experience as some features are hidden inside the GTAG.js. Server side is meant for events attached to a session, not the session it self.

Full server-to-server
While it's possible to send events to Google Analytics solely with measurement protocol, only partial reporting may be available. The purpose of measurement protocol is to augment existing events collected using gtag, GTM, or Firebase. Some event and parameter names are reserved for use through automatic collection and cannot be sent through the measurement protocol.
https://developers.google.com/analytics/devguides/collection/protocol/ga4

Thanks aawnu, I'll try playing with the sessions so I'll see if anything happens. Otherwise I'll try to create custom reports using bigquery/datastudio :)