AppMetricaConfiguration class

This class contains the extended startup configuration for the library.

The parameters of the extended configuration are applied from the time of library initialization.

Instance methods

init?(apiKey:)

Initializes the instance of the AppMetricaConfiguration class with the specified API key.

Properties

accurateLocationTracking

Enable/disable accurate location search for the internal location manager.

allowsBackgroundLocationUpdates

Enable/disable background tracking of location updates.

apiKey

The API key of the app.

appBuildNumber

Set an app build number for the AppMetrica report.

appEnvironment

Sets the app environment for all events from the moment of activation.

appOpenTrackingEnabled

Enables/disables the automatic collection and sending of data about app launches via a deeplink.

appVersion

App version.

areLogsEnabled

Enables/disables logging the activity of the library.

customHosts

Set proxy URLs for AppMetrica that will be used for startup queries.

customLocation

Sets custom location of the device.

dataSendingEnabled

Enables/disables sending statistics to the AppMetrica server.

dispatchPeriod

Set a custom sending period. Interval in seconds between sending events to the server.

handleActivationAsSessionStart

Defines the AppMetrica SDK initialization as the beginning of a user session. This option is disabled by default.

handleFirstActivationAsUpdate

Defines the first launch of the app as an update.

locationTracking

Enables/disables sending location of the device.

maxReportsCount

Set the maximum number of stored events.

maxReportsInDatabaseCount

The maximum number of error reports stored in the internal DB.

preloadInfo

Sets the instance of the AppMetricaPreloadInfo class for tracking pre-installed apps.

revenueAutoTrackingEnabled

Enables/disables the automatic collection of information about in-app purchases.

sessionTimeout

Sets the session timeout in seconds.

sessionsAutoTracking

Enables/disables automatic tracking of the app lifecycle.

userProfileID

Sets the ID of the user profile (ProfileID) when activated.

Method descriptions

init?(apiKey:)

public init?(apiKey: String)

Initializes the instance of the AppMetricaConfiguration class with the specified API key.

Parameters:

apiKey

The API key of the application.

Returns:

The AppMetricaConfiguration class instance.

Property descriptions

accurateLocationTracking

var accurateLocationTracking: Bool { get; set; }

Enable/disable accurate location search for the internal location manager. Disabled by default.

Active only if location tracking has been set to true, and the location isn't set manually.

allowsBackgroundLocationUpdates

var allowsBackgroundLocationUpdates: Bool { get; set; }

Enable/disable background tracking of location updates. Disabled by default.

To enable background tracking of location updates, set the property to true.

apiKey

var apiKey: String { get; }

The API key of the application.

appBuildNumber

var appBuildNumber: String? { get; set; }

Set an app build number for the AppMetrica report.

If not set, AppMetrica will use the app build number specified in the app configuration file Info.plist (CFBundleVersion). The app build number must be a numeric string that can be converted to a positive integer.

appEnvironment

var appEnvironment: [String : String]? { get; set; }

Sets the app environment for all events from the moment of activation.

appOpenTrackingEnabled

var appOpenTrackingEnabled: Bool { get; set; }

Enables/disables the automatic collection and sending of data about app launches via a deeplink.

Alert

Starting with version 4.0 of the AppMetrica SDK for iOS, app openings via deeplinks are tracked automatically. For other versions, set up tracking manually:

  • iOS AppMetrica SDK version below 4.0. Setting up deeplink tracking for UIApplicationDelegate.
  • Setting up deeplink tracking for UISceneDelegate (AppMetrica doesn't track such app openings automatically).

Automatic tracking captures only those deeplinks that resulted in app launches. To track deeplinks inside the running app, also set up tracking.

The option is enabled by default.

Possible values:

  • true: The mode of automatic collection and sending of data about the app launch via a deeplink is enabled.
  • false: The mode of automatic collection and sending of data about the app launch via a deeplink is disabled.

appVersion

var appVersion: String? { get; set; }

App version.

areLogsEnabled

var areLogsEnabled: Bool { get; set; }

Enables/disables logging the activity of the library.

Logging is disabled by default.

customHosts

var customHosts: [Any]? { get; set; }

Set proxy URLs for AppMetrica that will be used for startup queries.

customLocation

var customLocation: CLLocation? { get; set; }

dataSendingEnabled

var dataSendingEnabled: Bool { get; set; }

Sets custom location of the device.

dispatchPeriod

var dispatchPeriod: UInt { get; set; }

Set a custom sending period. Interval in seconds between sending events to the server.

By default, this is 90 seconds. Setting the value to 0 seconds prevents the library from automatically sending events using the timer.

handleActivationAsSessionStart

vat handleActivationAsSessionStart: Bool { get; set; }

Defines the AppMetrica SDK initialization as the beginning of a user session.

This option is disabled by default.

Possible values:

  • true: The user session is created when the library is initialized.
  • false: The background session is created when the library is initialized, and the user session is created after the UIApplicationDidBecomeActiveNotification system event.

handleFirstActivationAsUpdate

var handleFirstActivationAsUpdate: Bool { get; set; }

Defines the first launch of the app as an update.

Note

If the first launch of the app is defined as an update, the install is not shown as a new install in reports and is not attributed to partners.

Possible values:

  • true: The first launch is defined as an update.
  • false: The first launch is defined as a new install.

locationTracking

var locationTracking: Bool { get; set; }

Enables/disables sending location of the device.

By default, sending is enabled.

maxReportsCount

var maxReportsCount: UInt { get; set; }

Set the maximum number of stored events. The minimum number of cached events that causes reports to be sent automatically.

By default, events are sent automatically when there are at least 7 items in the storage.

Setting the value to 0 seconds prevents the library from automatically sending events upon reaching the set number of events in the storage.

maxReportsInDatabaseCount

var maxReportsInDatabaseCount: UInt { get; set; }

The maximum number of error reports stored in the internal DB.

The allowed range of values is [100; 10,000]. Values outside this range are automatically replaced with values from the nearest range limits.

Default value: 1000.

Note

Separate databases are used for various apiKeys and independent limits on the number of events can be set for them. This parameter only affects the limitation for the corresponding apiKey. To change the maximum allowed number of events for other apiKeys, use ReporterConfiguration.maxReportsInDatabaseCount.

preloadInfo

var preloadInfo: AppMetricaPreloadInfo? { get; set; }

Sets the instance of the AppMetricaPreloadInfo class for tracking pre-installed apps.

For more information, see Tracking pre-installed apps.

revenueAutoTrackingEnabled

var revenueAutoTrackingEnabled: Bool { get; set; }

Enables/disables the automatic collection of information about In-App purchases.

The option is enabled by default.

Possible values:

  • true: Automatic collection and sending of information about In-App purchases is enabled.
  • false: Automatic collection and sending of information about In-App purchases is disabled.

sessionTimeout

var sessionTimeout: UInt

Sets the session timeout in seconds. The default value is 10 (minimum allowed value).

For more information about sessions, see Tracking user activity.

sessionsAutoTracking

var sessionsAutoTracking: Bool { get; set; }

Enables/disables automatic tracking of the app lifecycle.

The option is enabled by default.

If the option is disabled, you need to manually set up session duration control using the pauseSession() and resumeSession() methods. For more information, see Manual session tracking.

AppMetrica uses UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification to track sessions. The maximum session length is 24 hours. To extend the session after 24 hours, invoke the resumeSession() method manually.

userProfileID

var userProfileID: String? { get; set; }

Sets the ID of the user profile (ProfileID) when activated.

Alert

The maximum length of the ProfileID string is 200 characters.