Hi all, I’m looking to get consistency across my a...
# questions
c
Hi all, I’m looking to get consistency across my app which uses both the Javascript API and the PHP SDK - specifically I’m trying to retain super properties such as
$os
$browser
$initial_referrer
etc. I’m following this article - https://help.mixpanel.com/hc/en-us/articles/360001355146-Keeping-Properties-Consistent-Across-Client-Server-Libraries I’m using the
mixpanel.get_property()
function on the callback of my
mixpanel.init
as described here - https://developer.mixpanel.com/docs/javascript-full-api-reference#mixpanelget_property Here is a code snippet:
Copy code
let mp_props = ['$initial_referrer', '$initial_referring_domain', '$os', '$browser', '$device', '$screen_height', '$screen_width'];
let mp_returned_props = {};

mixpanel.init(staging_token, {
    debug: debug,
    ignore_dnt: true,
    loaded: function(){
        mp_props.forEach(function(val){
          let prop = mixpanel.get_property(val);
          mp_returned_props[val] = prop;
        });
        console.log('mp_returned_props: ');
        console.log(mp_returned_props);
    }
});
However, when this is logged to the console, all I’m getting is
undefined
for these super properties (at least on the first visit when there is no mixpanel cookie) as you can see in the screenshot attached… On the second page load, strangely I do get
$initial_referrer
and
$initial_referring_domain
but others are still
undefined
- see second screenshot Can anyone assist please?