Integrating AppMetrica (Yandex) analytics into a mobile application
AppMetrica — the main choice for applications working in the Russian market: no blocking of Google services on some devices, data processed in the RF, integration with Yandex.Direct works without additional configuration. SDK available for iOS, Android and Flutter.
SDK connection
iOS — via Swift Package Manager or CocoaPods:
pod 'YandexMobileMetrica/Dynamic', '~> 5.0'
Initialization in AppDelegate:
import YandexMobileMetrica
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let config = YMMYandexMetricaConfiguration(apiKey: "YOUR_API_KEY")
config?.sessionTimeout = 120
config?.logs = false // disable in release
YMMYandexMetrica.activate(with: config!)
return true
}
Android via Gradle:
// build.gradle (app)
implementation("io.appmetrica.analytics:analytics:7.0.0")
// Application.onCreate()
val config = AppMetricaConfig.newConfigBuilder("YOUR_API_KEY")
.withSessionTimeout(120)
.withLogs(BuildConfig.DEBUG)
.build()
AppMetrica.activate(applicationContext, config)
AppMetrica.enableActivityAutoTracking(this)
enableActivityAutoTracking automatically logs Activity changes — similar to automatic screen_view.
Custom events and user profile
// iOS
YMMYandexMetrica.reportEvent("checkout_started", parameters: [
"cart_value": 4990,
"item_count": 3,
"payment_method": "card"
], onFailure: nil)
User Profile — a powerful AppMetrica feature that's often unused. Profile attributes allow audience segmentation in the dashboard:
let profile = YMMMutableUserProfile()
profile.apply(YMMProfileAttribute.customString("subscription_plan").withValue("premium"))
profile.apply(YMMProfileAttribute.customNumber("lifetime_orders").withValue(17))
profile.apply(YMMProfileAttribute.birthDate().withAge(28))
YMMYandexMetrica.report(profile, onFailure: nil)
On Android similar via UserProfile.newBuilder().
Attribution and install tracking
AppMetrica supports install attribution without a separate SDK: if a user comes from Yandex.Direct or through a deeplink with UTM tags, AppMetrica automatically binds the first session to the source. For third-party networks (Facebook Ads, Google UAC) integration is set up through partner postbacks in the console.
For deeplinks:
YMMYandexMetrica.handleOpen(url)
AppMetrica.reportAppOpen(activity)
Push notifications via AppMetrica Push
AppMetrica Push — built-in tool for push campaigns without Firebase Cloud Messaging (though compatible with FCM). To activate, pass the push token:
// iOS
YMMYandexMetrica.setUserProfileID("user_\(userId)")
Segments for distribution are built on the same events and profiles — no separate integration required.
Difference from Firebase Analytics
| Parameter | AppMetrica | Firebase Analytics |
|---|---|---|
| Data delay | ~10 min in realtime | up to 24 hours |
| Work without Google Play Services | Yes | No |
| Attribution without additional SDK | Yes (Yandex networks) | No |
| Yandex.Direct integration | Native | Through conversions |
| BigQuery export | Via DataLens | Paid plan |
What's included in the work
- SDK connection and initialization for iOS/Android/Flutter
- Setup of custom events according to tracking plan
- User profiles with attributes for segmentation
- Deeplink traffic transmission
- Data verification in AppMetrica dashboard
Timeline
Basic integration with events and profiles: 1–2 days. Cost calculated individually after requirements analysis.







