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.handleFirstActivationAsUpdateEnabledfalse

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

Тип: Boolean

A flag that indicates whether the automatic locating detection is enabled

config.sessionTimeout10

Тип: Number

Session timeout (in seconds)

config.reportCrashesEnabledtrue

Тип: Boolean

A flag that indicates whether crash monitoring is enabled

config.appVersionnull

Тип: String

App version

config.loggingEnabledfalse

Тип: Boolean

A flag that indicates whether the logging is enabled

config.locationnull

Тип: Object

Custom device location data in the specific format

config.preloadInfonull

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

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