Get Session Data
Introduced in SDK v4.5.3
What this does (purpose)
Returns a JSON snapshot of the current app/session context that you can log, persist, or forward to your analytics pipeline. Useful for debugging attribution, personalizing screens, or attaching metadata to your own events.
Method
Notifyvisitors.getSessionData(function(callback) {
// do your work here
});
Notifyvisitors.getSessionData(function(callback: JSON) {
// do your work here
});
Typical usage (log the payload)
Notifyvisitors.getSessionData(function(sessionData) {
console.log("Session Data = ",JSON.stringify(sessionData));
});
Notifyvisitors.getSessionData(function(sessionData: JSON) {
console.log("Session Data = ",JSON.stringify(sessionData));
});
Example response
{
"utm": {
"Source":"(direct)",
"campaign":"(direct)",
"medium":"(none)",
"keyword":"",
"content":"(not set)",
"Google_click_id":""
},
"session": {
"session_id":"u8rqPbALkFas0iXUPkhhvNWtbmudTkcg3ZKJDAdysZ2QZpny7Z",
"session_count":"3",
"user_type":"Unknown",
"visit_type":"returning"
},
"location": {
"country":"India",
"city":"Aligarh",
"region_code":"36",
"continent_code":"AS"
},
"device": {
"manufacturer":"Google",
"model":"sdk_gphone64_x86_64",
"carrier":"T-Mobile",
"network_type":"WIFI",
"wifi_enabled":true,
"bluetooth_enabled":"Enabled"
},
"app": {
"google_analytics_id":"bd4d1b45-5ded-42bd-93b6-8159b2a8091d",
"ios_ifa":"",
"screen_name":"Main Page",
"sdk_version":"5.6.0"
}
}
Updated 5 days ago
