Methods reference

activate

Activates the AppMetrica plugin with the given configuration.

activate(config)

Parameters

Параметр Значение по умолчанию Описание
config*

Тип: Object

Plugin configuration

config.apiKey*

Тип: String

A unique application identifier that is issued in the AppMetrica web interface during app registration.

config.handleFirstActivationAsUpdateEnabled false

Тип: Boolean

A flag that indicates whether the first launch of an app with the AppMetrica Plugin is an app update (not an installation)
Attention. If the first launch of the app is defined as an update, the installation is not shown as a new installation in reports, and is not attributed to partners.
config.trackLocationEnabled true

Тип: Boolean

A flag that indicates whether the automatic locating detection is enabled

config.sessionTimeout 10

Тип: Number

Session timeout (in seconds)

config.reportCrashesEnabled true

Тип: Boolean

A flag that indicates whether crash monitoring is enabled

config.appVersion null

Тип: String

App version

config.loggingEnabled 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

The tracker ID.

config.preloadInfo.additionalInfo

Тип: 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

* Обязательный параметр/опция.

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

* Обязательный параметр/опция.

setCustomAppVersion

Sets a custom app version.

setCustomAppVersion(appVersion)

Parameters

Параметр Значение по умолчанию Описание
appVersion*

Тип: String

App version

* Обязательный параметр/опция.

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

* Обязательный параметр/опция.

setTrackLocationEnabled

Enables or disables automatic location detection.

setTrackLocationEnabled(enabled)

Parameters

Параметр Значение по умолчанию Описание
enabled*

Тип: Boolean

A flag that indicates whether the automatic locating detection is enabled

* Обязательный параметр/опция.

setSessionTimeout

Sets the session timeout length. The minimum acceptable value for the sessionTimeoutSeconds parameter is 10 seconds. If a value less than 10 is set, the value will automatically be 10 seconds.

setSessionTimeout(sessionTimeoutSeconds)

Parameters

Параметр Значение по умолчанию Описание
sessionTimeoutSeconds* 10

Тип: Number

Session timeout in seconds

* Обязательный параметр/опция.

setReportCrashesEnabled

Enables or disables app crashes monitoring.

setReportCrashesEnabled(enabled)

Parameters

Параметр Значение по умолчанию Описание
enabled* true

Тип: Boolean

A flag that indicates whether the crashes monitoring is enabled

* Обязательный параметр/опция.

setLoggingEnabled

Enables logging.

setLoggingEnabled()

setCollectInstalledAppsEnabled

Enables or disables data transmission about installed apps on the device.

Attention. Works only on Android devices.
setCollectInstalledAppsEnabled(enabled)

Parameters

Параметр Значение по умолчанию Описание
enabled* false

Тип: Boolean

A flag that indicates whether data transmission about installed apps on the device is enabled

* Обязательный параметр/опция.