-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setClientId() not specified receives a null value #1
Comments
To my information the client ID is also not the whole _ga cookie, instead its somthing like |
indeed you were right... almost ;) basically we need to pass the value after the second dot. PHP code is in the link I pasted if you need. |
@yanict Yes you are right, both the random ID (3rd part) and the timestamp the cookie was created (4th part) are together the clientId. Just did a test comparing the cookie and the value returned from the GA Tracker object in Javascript. @ALL How should the exact behavior be defined? Should this bundle handle all automagically? Test for _ga cookie, if not set, create own clientId, set own cookie and so on (needs also all be configurable). As the clientId is mandatory, but can't be set in parameters as the other mandatory values, make it more explicitly clear by changing the factory to somewhat Dunno whats the best way |
I'm not reopening this issue but here we are with this:
For now, I workaround this by setting the clientId equals to the userId For example, the service Segment do the same thing:
https://segment.com/docs/integrations/google-analytics/ But it is not ideal... you need to send event only if user is in context (you can send event with anonymous user without the _ga cookie)... One solution can be to generate the cookie and set it into the header when the clientId is null. But it will work for application which handles cookies and read the header set-cookie... And if the client application of our REST service doesn't manage cookie, this solution will generate one clientId to each request and it will generate a new user each time... I continue thinking about this... but one solution can be to stop reporting Analytics through the backend and use only JavaScript to report data... Develop webapp and no more website... |
Hi,
I noticed I had a lot of log entries with the following message :
Uncaught PHP Exception InvalidArgumentException: "For Analytics object, you must specify a value to be set for setClientId"
Also, after looking for a while in my code, I found that there was an error in the AnalyticsFactory class on line 25.
->setClientId($request->cookies->get('_ga', null))
Based on the Google Analytics Measurement Protocol library for PHP the **setClientId _method need a value and cannot receive a _null.
Am I right and does anybody also had this problem ?
Thanks for your advice.
The text was updated successfully, but these errors were encountered: