AppMetrica
This guide describes how to add and configure AppMetrica integration.
AppMetrica is a free real-time ad tracking and mobile app analytics solution.
Since AppMetrica doesn't support "fake" sessions so far, all events are being sent in background mode. So, they won't appear in the User profile, but you can see these in Devices events instead.
As soon as AppMetrica release "fake" sessions for server-to-server events, we will change it back to foreground mode.
Currently, POST API events are unavailable in Profiles. Looking forward AppMetrica will implement this (no particular date).
Keep in mind, that the data sent from the AppMetrica Post API is synchronized every 4 hours.
Sending built-in revenue in AppMetrica is not yet supported due to limitations of their Server-to-Server API. Currently, we send all revenue values as custom parameters: usd_price and local_price

How to Add Integration?

Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
    Open AppMetrica and go to Settings of your app.
    Copy Application ID and Post API Key fields (not API key!).
At Apphud go to "Integrations" section and add AppMetrica:
Enter Post API Key and Application ID values into their corresponding fields:
You can enter your custom event names or disable some:
Enable integration and click Save:

Match User IDs

Here is an example of initialising both SDKs with User IDs matching.
Swift
Kotlin
Java
1
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2
3
Apphud.start(apiKey: "YOUR_API_KEY")
4
Apphud.setDelegate(self)
5
6
if let configuration = YMMYandexMetricaConfiguration.init(apiKey: "AppMetrica-API-Key") {
7
YMMYandexMetrica.activate(with: configuration)
8
YMMYandexMetrica.setUserProfileID(Apphud.userID())
9
}
10
11
return true
12
}
13
14
// implement ApphudDelegate
15
func apphudDidChangeUserID(_ userID: String) {
16
// Match again
17
YMMYandexMetrica.setUserProfileID(Apphud.userID())
18
}
Copied!
1
Apphud.start(apiKey: "YOUR_API_KEY")
2
val config: YandexMetricaConfig = YandexMetricaConfig.newConfigBuilder(Constants.Appmetrica_API_KEY).build()
3
YandexMetrica.activate(applicationContext, config)
4
YandexMetrica.setUserProfileID(Apphud.userId())
5
YandexMetrica.enableActivityAutoTracking(this)
Copied!
1
Apphud.start(apiKey: "YOUR_API_KEY")
2
YandexMetricaConfig config = YandexMetricaConfig.newConfigBuilder(API_key).build();
3
YandexMetrica.activate(getApplicationContext(), config);
4
YandexMetrica.setUserProfileID(Apphud.userId());
5
YandexMetrica.enableActivityAutoTracking(this);
Copied!

Events Cheat Sheet

This is a list of all possible events and their parameters that are being sent to AppMetrica.
You can read more about subscription events here and about parameters here.
Trial
Cancellations
Introductory Offer
Regular
Promo Offer
Other Events

Trial period started

Default event name: [Apphud] trial_started
Parameters:
    product_id: String
    unit: String
    units_count: Integer

Successful conversion from trial period to regular subscription

Default event name: [Apphud] trial_converted
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float

Failed conversion from trial period to regular subscription

Default event name: [Apphud] trial_expired
Parameters:
    product_id: String
    reason: String

Trial Canceled

Default event name: [Apphud] trial_canceled
Parameters:
    product_id: String

Subscription Canceled

Default event name: [Apphud] subscription_canceled
Parameters:
    product_id: String

Autorenew disabled (Deprecated)

Default event name: [Apphud] autorenew_disabled
Parameters:
    product_id: String

Autorenew enabled

Default event name: [Apphud] autorenew_enabled
Parameters:
    product_id: String

Introductory offer started

Default event name: [Apphud] intro_started
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float
    offer_type: String
    unit: String
    units_count: Integer

Introductory offer renewed

Default event name: [Apphud] intro_renewed
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float
    offer_type: String
    unit: String
    units_count: Integer

Successful conversion from introductory offer to regular subscription

Default event name: [Apphud] intro_converted
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float
    offer_type: String

Failed conversion from introductory offer to regular subscription or failed renew

Default event name: [Apphud] intro_expired
Parameters:
    product_id: String
    reason: String
    offer_type: String

Refund during introductory offer

Default event name: [Apphud] intro_refunded
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float
    reason: String
    offer_type: String

Subscription started

Default event name: [Apphud] subscription_started
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float

Subscription renewed

Default event name: [Apphud] subscription_renewed
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float

Subscription expired

Default event name: [Apphud] subscription_expired
Parameters:
    product_id: String
    reason: String

Subscription refunded

Default event name: [Apphud] subscription_refunded
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float
    reason: String

Promotional offer started

Default event name: [Apphud] promo_started
Parameters:
    product_id: String
    offer_id: String
    local_price: Float
    currency: String
    usd_price: Float
    offer_type: String
    unit: String
    units_count: Integer

Promotional offer renewed

Default event name: [Apphud] promo_renewed
Parameters:
    product_id: String
    offer_id: String
    local_price: Float
    currency: String
    usd_price: Float
    offer_type: String
    unit: String
    units_count: Integer

Successful conversion from promotional offer to regular subscription

Default event name: [Apphud] promo_converted
Parameters:
    product_id: String
    offer_id: String
    local_price: Float
    currency: String
    usd_price: Float
    offer_type: String

Failed conversion from promotional offer to regular subscription or failed renew

Default event name: [Apphud] promo_expired
Parameters:
    product_id: String
    offer_id: String
    reason: String
    offer_type: String

Refund during promotional offer

Default event name: [Apphud] promo_refunded
Parameters:
    product_id: String
    offer_id: String
    local_price: Float
    currency: String
    usd_price: Float
    reason: String
    offer_type: String

Non renewing purchase

Default event name: [Apphud] non_renewing_purchase
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float

Non renewing purchase refunded

Default event name: [Apphud] non_renewing_purchase_refunded
Parameters:
    product_id: String
    local_price: Float
    currency: String
    usd_price: Float
    reason: String

Billing issue

Default event name: [Apphud] billing_issue
Parameters:
    product_id: String

Billing issue Resolved

Default event name: [Apphud] billing_issue_resolved
Parameters:
    product_id: String
Last modified 5mo ago