Methods
Support and development of the plugin has been stopped. We do not guarantee the SDK will work correctly.
In the code, use window.appMetrica
for accessing AppMetrica.
activate
Activates the AppMetrica plugin with the given configuration.
activate(config)
Parameters
Parameter | Default value | Description |
---|---|---|
config* | — | Тип: Object Plugin configuration |
config.apiKey* | — | Тип: String A unique application identifier that is issued in the AppMetrica web interface during app registration. |
config.handleFirstActivationAsUpdate | false | Тип: Boolean A flag that indicates whether the first launch of an app with the AppMetrica Plugin is an app update (not an installation) handleFirstActivationAsUpdate(boolean) |
config.locationTracking | true | Тип: Boolean A flag that indicates whether the automatic locating detection is enabled |
config.sessionTimeout | 10 | Тип: Number Session timeout (in seconds) |
config.crashReporting | true | Тип: Boolean A flag that indicates whether the crashes monitoring is enabled |
config.appVersion | null | Тип: String App version |
config.logs | false | Тип: Boolean A flag that indicates whether the logging is enabled |
config.location | null | Тип: Object Custom device location data in the specific format |
config.preloadInfo | null | Тип: Object Data for tracking pre-installed apps |
config.preloadInfo.trackingId* | — | Тип: Object |
config.preloadInfo.additionalParams | — | Тип: Object Additional information for tracking pre-installed apps. Specified as a key-value pair |
Parameter | Default value | Description |
---|---|---|
config* | — | Тип: Object Plugin configuration |
config.apiKey* | — | Тип: String A unique application identifier that is issued in the AppMetrica web interface during app registration. |
config.handleFirstActivationAsUpdate | false | Тип: Boolean A flag that indicates whether the first launch of an app with the AppMetrica Plugin is an app update (not an installation) handleFirstActivationAsUpdate(boolean) |
config.locationTracking | true | Тип: Boolean A flag that indicates whether the automatic locating detection is enabled |
config.sessionTimeout | 10 | Тип: Number Session timeout (in seconds) |
config.crashReporting | true | Тип: Boolean A flag that indicates whether the crashes monitoring is enabled |
config.appVersion | null | Тип: String App version |
config.logs | false | Тип: Boolean A flag that indicates whether the logging is enabled |
config.location | null | Тип: Object Custom device location data in the specific format |
config.preloadInfo | null | Тип: Object Data for tracking pre-installed apps |
config.preloadInfo.trackingId* | — | Тип: Object |
config.preloadInfo.additionalParams | — | Тип: Object Additional information for tracking pre-installed apps. Specified as a key-value pair |
* Обязательный параметр/опция.
reportEvent
Sends a custom event message.
reportEvent(eventName[, params])
Parameters
Параметр | Значение по умолчанию | Описание |
---|---|---|
eventName* | — | Тип: String Short name or description of the event |
params | — | Тип: Object The JavaScript object as key-value pairs to be sent to the server |
Параметр | Значение по умолчанию | Описание |
---|---|---|
eventName* | — | Тип: String Short name or description of the event |
params | — | Тип: Object The JavaScript object as key-value pairs to be sent to the server |
* Обязательный параметр/опция.
reportError
Sends a custom error message.
reportError(errorName[, reason])
Parameters
Параметр | Значение по умолчанию | Описание |
---|---|---|
errorName* | — | Тип: String Short name or description of the error |
reason | — | Тип: String Reason of the error |
Параметр | Значение по умолчанию | Описание |
---|---|---|
errorName* | — | Тип: String Short name or description of the error |
reason | — | Тип: String Reason of the error |
* Обязательный параметр/опция.
setLocation
Sets a custom location value.
setLocation(location)
Parameters
Параметр | Значение по умолчанию | Описание |
---|---|---|
location* | — | Тип: Object Device location data |
location.latitude* | — | Тип: Number Latitude in degrees |
location.longitude* | — | Тип: Number Longitude in degrees |
location.altitude | — | Тип: Number Altitude in degrees |
location.accuracy | — | Тип: Number Horizontal accuracy in meters |
location.verticalAccuracy | — | Тип: Number Vertical accuracy in meters |
location.course | — | Тип: Number Movement course in degrees |
location.speed | — | Тип: Number Movement speed in km/h |
location.timestamp | — | Тип: Number Unix format timestamp of location |
Параметр | Значение по умолчанию | Описание |
---|---|---|
location* | — | Тип: Object Device location data |
location.latitude* | — | Тип: Number Latitude in degrees |
location.longitude* | — | Тип: Number Longitude in degrees |
location.altitude | — | Тип: Number Altitude in degrees |
location.accuracy | — | Тип: Number Horizontal accuracy in meters |
location.verticalAccuracy | — | Тип: Number Vertical accuracy in meters |
location.course | — | Тип: Number Movement course in degrees |
location.speed | — | Тип: Number Movement speed in km/h |
location.timestamp | — | Тип: Number Unix format timestamp of location |
* Обязательный параметр/опция.
setLocationTracking
Enables or disables automatic location detection.
setLocationTracking(enabled)
Parameters
Параметр | Значение по умолчанию | Описание |
---|---|---|
enabled* | — | Тип: Boolean A flag that indicates whether the automatic locating detection is enabled |
Параметр | Значение по умолчанию | Описание |
---|---|---|
enabled* | — | Тип: Boolean A flag that indicates whether the automatic locating detection is enabled |
* Обязательный параметр/опция.