Question

Default properties for PHP

  • 5 January 2021
  • 4 replies
  • 71 views

Hello! I am following the php documentation https://developer.mixpanel.com/docs/php to implement in my laravel app, I see that there are some default properties https://help.mixpanel.com/hc/en-us/articles/115004613766-Default-Properties-Collected-by-Mixpanel that are not included in the php library, I already saw how to do the location https://help.mixpanel.com/hc/en-us/articles/115004499343-Tracking-geolocation-with-server-side-implementation but the rest of the properties such as browser, Browser Version, etc how can I add them?


4 replies

Userlevel 3
Badge +1

The default properties are collected by the client-side libraries. With php you are sending events from the server. That won’t have browser and other client side information. You will need to get these pieces from the FE and attach these properties to the backend events through your code.

 @Jaya Thanks for your reply! ok let me search about that, what do you mean about FE?

Userlevel 3
Badge +1

Sorry 🙂 FE = Front end (that is your mobile app, or FE of your web app where you would use javascript library of Mixpanel)

Hello @Jaya  thanks for your reply! ok I already installed js library and it’s working fine I’m following this guide Keeping Properties Consistent Across Client & Server Libraries – Mixpanel Help Center for get properties like browser, OS, etc so they said use the following code on your view:

mixpanel.init( "YOUR TOKEN", {'loaded': function() {      var superProperty = mixpanel.get_property("SuperProperty"); } });

So I put

mixpanel.init( "MY TOKEN", {'loaded': function() {      var superProperty = mixpanel.get_property("$browser"); } });

it’s ok? what am I doing wrong?

and to send the property to my backend in php I have to search on google or mixpanel has example?

Regards

Reply


Mixpanel