public class AnalyticsContext extends ValueMap
This is renamed to AnalyticsContext on Android to avoid confusion with Context
in the
Android framework. Any documentation for Context on our website is referring to AnalyticsContext
on Android.
Some keys in the context dictionary have semantic meaning and will be collected for you automatically, depending on the library you send data from. Some keys, such as IP address, and speed need to be manually entered, such as IP Address, speed, etc.
AnalyticsContext is not persisted to disk, and is filled each time the app starts.
Modifier and Type | Class and Description |
---|---|
static class |
AnalyticsContext.Campaign
Information about the campaign that resulted in the API call, containing name, source, medium,
term and content.
|
static class |
AnalyticsContext.Device
Information about the device.
|
static class |
AnalyticsContext.Location
Information about the location of the device.
|
static class |
AnalyticsContext.Referrer
Information about the referrer that resulted in the API call.
|
Modifier and Type | Method and Description |
---|---|
AnalyticsContext.Campaign |
campaign() |
AnalyticsContext.Device |
device() |
AnalyticsContext.Location |
location() |
AnalyticsContext |
putCampaign(AnalyticsContext.Campaign campaign)
Set information about the campaign that resulted in the API call.
|
AnalyticsContext |
putDeviceToken(java.lang.String token)
Set a device token.
|
AnalyticsContext |
putLocation(AnalyticsContext.Location location)
Set location information about the device.
|
AnalyticsContext |
putReferrer(AnalyticsContext.Referrer referrer)
Set the referrer for this session.
|
AnalyticsContext |
putValue(java.lang.String key,
java.lang.Object value)
Helper method to be able to chain put methods.
|
Traits |
traits()
Note: Not for public use.
|
AnalyticsContext |
unmodifiableCopy()
Returns an unmodifiable shallow copy of the values in this map.
|
clear, containsKey, containsValue, entrySet, equals, get, getBoolean, getChar, getDouble, getEnum, getFloat, getInt, getList, getLong, getString, getValueMap, getValueMap, hashCode, isEmpty, keySet, put, putAll, remove, size, toJsonObject, toString, toStringMap, values
public AnalyticsContext putValue(java.lang.String key, java.lang.Object value)
ValueMap
public AnalyticsContext unmodifiableCopy()
public Traits traits()
Analytics.identify(String, Traits, Options)
. Modifying this instance will not reflect changes
to the user's information that is passed onto bundled integrations.
Return the Traits
attached to this instance.
public AnalyticsContext putCampaign(AnalyticsContext.Campaign campaign)
public AnalyticsContext.Campaign campaign()
public AnalyticsContext.Device device()
public AnalyticsContext putDeviceToken(java.lang.String token)
AnalyticsContext.Device.putDeviceToken(String)
public AnalyticsContext putLocation(AnalyticsContext.Location location)
public AnalyticsContext.Location location()
public AnalyticsContext putReferrer(AnalyticsContext.Referrer referrer)