Get Session Data
Introduced in SDK v5.5.4
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, personalising screens, or attaching metadata to your own events.
Note: The Cordova plugin wraps the session payload inside an
nvkey. Access the data viaresponse.nv.
Method
JavaScript
NotifyVisitors.getSessionData(function(response) {
// do your work here
});
NotifyVisitors.getSessionData(function(response: JSON) {
// do your work here
});
Typical usage (log the payload)
NotifyVisitors.getSessionData(function(response) {
var sessionData= response.nv;
console.log("Session Data = ",JSON.stringify(sessionData));
});
NotifyVisitors.getSessionData(function(response: JSON) {
const sessionData = response.nv;
console.log("Session Data = ",JSON.stringify(sessionData));
});
Example response
{
"nv": {
"utm": {
"source":"google-play",
"campaign":"(not set)",
"medium":"organic",
"keyword":"",
"content":"(not set)",
"google_click_id":""
},
"session": {
"session_id":"sPdEuB6Nzl3VZ1DqMlOhxlbqm7DaxQe2JzjH9cvCo7ArR1Rz7c",
"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":"MainActivity",
"sdk_version":"5.6.0"
}
}
}
Updated 5 days ago
