Documentation

Installation and initialization

The AppMetrica library supports several platforms:

Step 1. The library can work with the following dependency managers:

The library supports static and dynamic frameworks for CocoaPods. To enable the library, add the dependency to the project Podfile (example for integrating a static framework):

  • Static framework

    pod 'YandexMobileMetrica', '2.9.1'
  • Dynamic framework

    pod 'YandexMobileMetrica/Dynamic', '2.9.1'
Note. If the Podfile has the use_frameworks! string, we recommend using a dynamic framework.

To enable the library, add the following dependency to the Cartfile and save the file:

github "yandexmobile/metrica-sdk-ios" ~> 2.9.1
If you don't use these dependency managers

To enable the library, follow these steps:

  1. Download the AppMetrica library.
  2. Add YandexMobileMetrica.framework to the project.
  3. Add the following dependencies: 'SystemConfiguration', 'UIKit', 'Foundation', 'CoreTelephony', 'CoreLocation', 'CoreGraphics', 'AdSupport', 'z', 'sqlite3', 'Security', 'c++', 'SafariServices' (with the Optional setting).
  4. Add -ObjC to Other Linker Flags.

Step 2. Initialize the library in the initialize UIApplicationDelegate method:

+ (void)initialize
{
   if ([self class] == [MMSAppDelegate class]) {
       //Initializing the AppMetrica SDK
       [YMMYandexMetrica activateWithApiKey
[no-highlight[

Allows you to start the statistics collection process

]no-highlight]
:@API_key
[no-highlight[

The API key is a unique application identifier that is issued in the AppMetrica web interface during app registration.

]no-highlight]
]
; } }
What is the API key?

The API key is a unique application identifier that is issued in the AppMetrica web interface during app registration. Make sure you have entered it correctly.

AppMetrica allows tracking pre-installed apps. To use this feature, you must initialize the library with the extended configuration.

Note. Requirements: deployment target 6.0 and higher.

Step 1. The library can work with the following dependency managers:

The library supports static and dynamic frameworks for CocoaPods. To enable the library, add the dependency to the project Podfile (example for integrating a static framework):

  • Static framework

    pod 'YandexMobileMetrica', '2.9.1'
  • Dynamic framework

    pod 'YandexMobileMetrica/Dynamic', '2.9.1'
Note. If the Podfile has the use_frameworks! string, we recommend using a dynamic framework.

To enable the library, add the following dependency to the Cartfile and save the file:

github "yandexmobile/metrica-sdk-ios" ~> 2.9.1
If you don't use these dependency managers

To enable the library, follow these steps:

  1. Download the AppMetrica library.
  2. Add YandexMobileMetrica.framework to the project.
  3. Add the following dependencies: 'SystemConfiguration', 'UIKit', 'Foundation', 'CoreTelephony', 'CoreLocation', 'CoreGraphics', 'AdSupport', 'z', 'sqlite3', 'Security', 'c++', 'SafariServices' (with the Optional setting).
  4. Add -ObjC to Other Linker Flags.

Step 2. Initialize the library in the extension's initialize NSExtensionPrincipalClass:

+ (void)initialize
{
   if ([self class] == [MMSTodayViewController class]) {
       //Initializing the AppMetrica SDK
       [YMMYandexMetrica activateWithApiKey
[no-highlight[

Allows you to start the statistics collection process

]no-highlight]
:@API_key
[no-highlight[

The API key is a unique application identifier that is issued in the AppMetrica web interface during app registration.

]no-highlight]
]
; } }
What is the API key?

The API key is a unique application identifier that is issued in the AppMetrica web interface during app registration. Make sure you have entered it correctly.

AppMetrica allows tracking pre-installed apps. To use this feature, you must initialize the library with the extended configuration.

Note. Requirements: deployment target 6.0 and higher.

Step 1. The library can work with the following dependency managers:

The library supports static and dynamic frameworks for CocoaPods. To enable the library, add the dependency to the project Podfile (example for integrating a static framework):

  • Static framework

    pod 'YandexMobileMetrica', '2.9.1'
  • Dynamic framework

    pod 'YandexMobileMetrica/Dynamic', '2.9.1'
Note. If the Podfile has the use_frameworks! string, we recommend using a dynamic framework.

To enable the library, add the following dependency to the Cartfile and save the file:

github "yandexmobile/metrica-sdk-ios" ~> 2.9.1
If you don't use these dependency managers

To enable the library, follow these steps:

  1. Download the AppMetrica library.
  2. Add YandexMobileMetrica.framework to the project.
  3. Add the following dependencies: 'SystemConfiguration', 'UIKit', 'Foundation', 'CoreTelephony', 'CoreLocation', 'CoreGraphics', 'AdSupport', 'z', 'sqlite3', 'Security', 'c++', 'SafariServices' (with the Optional setting).
  4. Add -ObjC to Other Linker Flags.

Step 2. Initialize the library in the extension's initialize Main Entry Point method (there may be multiple activation points):

+ (void)initialize
{
   if ([self class] == [MMSInterfaceController class]) {
       //Initializing the AppMetrica SDK
       [YMMYandexMetrica activateWithApiKey
[no-highlight[

Allows you to start the statistics collection process

]no-highlight]
:@API_key
[no-highlight[

The API key is a unique application identifier that is issued in the AppMetrica web interface during app registration.

]no-highlight]
]
; } }

or

+ (void)initialize
{
   if ([self class] == [MMSNotificationController class]) {
       //Initializing the AppMetrica SDK
       [YMMYandexMetrica activateWithApiKey
[no-highlight[

Allows you to start the statistics collection process

]no-highlight]
:@API_key
[no-highlight[

The API key is a unique application identifier that is issued in the AppMetrica web interface during app registration.

]no-highlight]
]
; } }
What is the API key?

The API key is a unique application identifier that is issued in the AppMetrica web interface during app registration. Make sure you have entered it correctly.

AppMetrica allows tracking pre-installed apps. To use this feature, you must initialize the library with the extended configuration.

Note. Requirements: deployment target 6.0 and higher.