Context includes data such as Browser details, Device details, Operating System, Screen Size, Time Zone, Geography, etc.
Firstparty.js automatically populates several Context fields for every collected Event.
When sending an event to Firstparty using the HTTP API the Context is optional but should be considered a good practice to include.
Location
Firstparty will use the IP address an Event's payload was sent from and attempt to fill the context.location
object if it is empty.
Example Context Object
Here is a sample of a complete Context object in JSON:
{
"context": {
"app": {
"name": "Support",
"version": "2.1",
"build": "14809",
"namespace": "com.domain.support"
},
"campaign": {
"name": "Campaign Name",
"source": "social",
"medium": "twitter",
"term": "keyword",
"content": "image link"
},
"device": {
"id": "guid-guid-guid-guid",
"advertising_id": "guid-guid-guid-guid",
"ad_tracking_enabled": true,
"manufacturer": "Apple",
"model": "iPhone 13,1",
"name": "Iphone",
"type": "ios",
"token": "guid-guid-guid-guid"
},
"ip": "123.123.123.123",
"locale": "en-US",
"location": {
"city": "Scottsdale",
"country": "USA",
"continent": "North America",
"postal": "",
"subdivision": "",
"latitude": "33.494978",
"longitude": "-111.926127",
"is_european_union": false
},
"network": {
"bluetooth": true,
"carrier": "T-Mobile",
"cellular": true,
"wifi": false
},
"os": {
"name": "iPhone OS",
"version": "13.0.1"
},
"browser": {
"name": "Safari",
"version": "15.1"
},
"page": {
"path": "/support/chat",
"referrer": "/support",
"search": "corporis",
"title": "Support Chat",
"url": "https://app.domain.com/support/chat"
},
"screen": {
"height": "1750",
"width": "1150"
},
"timezone": "America/Phoenix",
"useragent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko)",
"bot": {
"name": "",
"is_bot": false
}
}
}