AMAAppMetricaConfiguration 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

-initWithAPIKey:

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

Properties

APIKey

The API key of the app.

accurateLocationTracking

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

allowsBackgroundLocationUpdates

Enable/disable background tracking of location updates.

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.

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.

logsEnabled

Enables/disables logging the activity of the library.

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 AMAAppMetricaPreloadInfo 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

-initWithAPIKey:

- (instancetype)initWithAPIKey:(NSString *)APIKey

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

Parameters:

APIKey

The API key of the app.

Returns:

The AMAAppMetricaConfiguration class instance.

Property descriptions

APIKey

@property (nonatomic, copy, readonly) NSString *APIKey;

The API key of the application.

accurateLocationTracking

@property (nonatomic, assign) BOOL accurateLocationTracking;

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

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

allowsBackgroundLocationUpdates

@property (nonatomic, assign) BOOL allowsBackgroundLocationUpdates;

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

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

appBuildNumber

@property (nonatomic, copy, nullable) NSString *appBuildNumber;

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

@property (nonatomic, copy, nullable) NSDictionary<NSString *, NSString *> *appEnvironment;

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

appOpenTrackingEnabled

@property (nonatomic, assign) BOOL appOpenTrackingEnabled;

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:

  • YES: Automatic collection and sending of data about the app launch via a deeplink is enabled.
  • NO: Automatic collection and sending of data about the app launch via a deeplink is disabled.

appVersion

@property (nonatomic, copy, nullable) NSString *appVersion;

App version.

customHosts

@property (nonatomic, copy, nullable) NSArray *customHosts;

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

customLocation

@property (nonatomic, strong, nullable) CLLocation *customLocation;

dataSendingEnabled

@property (nonatomic, assign) BOOL dataSendingEnabled;

Sets custom location of the device.

dispatchPeriod

@property (nonatomic, assign) NSUInteger dispatchPeriod;

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

@property (nonatomic, assign) BOOL handleActivationAsSessionStart;

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

This option is disabled by default.

Possible values:

  • YES: The user session is created when the library is initialized.
  • NO: A background session is created when the library is initialized, and a user session is created after the UIApplicationDidBecomeActiveNotification system event.

handleFirstActivationAsUpdate

@property (nonatomic, assign) BOOL handleFirstActivationAsUpdate;

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:

  • YES: The first launch is defined as an update.
  • NO: The first launch is defined as a new install.

locationTracking

@property (nonatomic, assign) BOOL locationTracking;

Enables/disables sending location of the device.

By default, sending is enabled.

logsEnabled

@property (nonatomic, assign, getter=areLogsEnabled) BOOL logsEnabled;

Enables/disables logging the activity of the library.

Logging is disabled by default.

maxReportsCount

@property (nonatomic, assign) NSUInteger maxReportsCount;

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

@property (nonatomic, assign) NSUInteger maxReportsInDatabaseCount;

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 AMAReporterConfiguration.maxReportsInDatabaseCount.

preloadInfo

@property (nonatomic, copy, nullable) AMAAppMetricaPreloadInfo *preloadInfo;

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

For more information, see Tracking pre-installed apps.

revenueAutoTrackingEnabled

@property (nonatomic, assign) BOOL revenueAutoTrackingEnabled;

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

The option is enabled by default.

Possible values:

  • YES: Automatic collection and sending of information about in-app purchases is enabled.
  • NO: Automatic collection and sending of information about in-app purchases is disabled.

sessionTimeout

@property (nonatomic, assign) NSUInteger sessionTimeout;

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

For more information about sessions, see Tracking user activity.

sessionsAutoTracking

@property (nonatomic, assign) BOOL sessionsAutoTracking;

Enables/disables automatic tracking of the application 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

@property (nonatomic, copy, nullable) NSString *userProfileID;

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

Alert

The maximum length of the ProfileID string is 200 characters.