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.
Important Note
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
__ andlocal_price
How to Add Integration?
Step 1
- Integrate Apphud SDK.
- Integrate AppMetrica.
- Match User IDs between AppMetrica and Apphud.
Step 2
- Open AppMetrica and go to Settings of your app.
- Copy Application ID and Post API Key fields (not API key!).

Step 3
At Apphud go to "Integrations" section and add AppMetrica:

Step 4
Enter Post API Key and Application ID values into their corresponding fields:

Step 5
You can enter your custom event names or disable some:

Step 6
Enable integration and click Save:

Match User IDs
Here is an example of initialising both SDKs with User IDs matching.
Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Apphud.start(apiKey: "YOUR_API_KEY")
Apphud.setDelegate(self)
if let configuration = YMMYandexMetricaConfiguration.init(apiKey: "AppMetrica-API-Key") {
YMMYandexMetrica.activate(with: configuration)
YMMYandexMetrica.setUserProfileID(Apphud.userID())
}
return true
}
// implement ApphudDelegate
func apphudDidChangeUserID(_ userID: String) {
// Match again
YMMYandexMetrica.setUserProfileID(Apphud.userID())
}
Kotlin
Apphud.start(apiKey: "YOUR_API_KEY")
val config: YandexMetricaConfig = YandexMetricaConfig.newConfigBuilder(Constants.Appmetrica_API_KEY).build()
YandexMetrica.activate(applicationContext, config)
YandexMetrica.setUserProfileID(Apphud.userId())
YandexMetrica.enableActivityAutoTracking(this)
Java
Apphud.start(apiKey: "YOUR_API_KEY")
YandexMetricaConfig config = YandexMetricaConfig.newConfigBuilder(API_key).build();
YandexMetrica.activate(getApplicationContext(), config);
YandexMetrica.setUserProfileID(Apphud.userId());
YandexMetrica.enableActivityAutoTracking(this);
Events Cheat Sheet
This is a list of all possible events and their parameters that are being sent to AppMetrica.
Note
You can read more about subscription events here and about parameters here.
Trial
Trial period started
Default event name: [Apphud] trial_started
Parameters:
product_id
: Stringunit
: Stringunits_count
: Integer
Successful conversion from trial period to regular subscription
Default event name: [Apphud] trial_converted
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Float
Failed conversion from trial period to regular subscription
Default event name: [Apphud] trial_expired
Parameters:
product_id
: Stringreason
: String
Cancellations
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
Introductory offer started
Default event name: [Apphud] intro_started
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatoffer_type
: Stringunit
: Stringunits_count
: Integer
Introductory offer renewed
Default event name: [Apphud] intro_renewed
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatoffer_type
: Stringunit
: Stringunits_count
: Integer
Successful conversion from introductory offer to regular subscription
Default event name: [Apphud] intro_converted
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatoffer_type
: String
Failed conversion from introductory offer to regular subscription or failed renew
Default event name: [Apphud] intro_expired
Parameters:
product_id
: Stringreason
: Stringoffer_type
: String
Refund during introductory offer
Default event name: [Apphud] intro_refunded
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatreason
: Stringoffer_type
: String
Regular
Subscription started
Default event name: [Apphud] subscription_started
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Float
Subscription renewed
Default event name: [Apphud] subscription_renewed
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Float
Subscription expired
Default event name: [Apphud] subscription_expired
Parameters:
product_id
: Stringreason
: String
Subscription refunded
Default event name: [Apphud] subscription_refunded
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatreason
: String
Promo Offer
Promotional offer started
Default event name: [Apphud] promo_started
Parameters:
product_id
: Stringoffer_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatoffer_type
: Stringunit
: Stringunits_count
: Integer
Promotional offer renewed
Default event name: [Apphud] promo_renewed
Parameters:
product_id
: Stringoffer_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatoffer_type
: Stringunit
: Stringunits_count
: Integer
Successful conversion from promotional offer to regular subscription
Default event name: [Apphud] promo_converted
Parameters:
product_id
: Stringoffer_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatoffer_type
: String
Failed conversion from promotional offer to regular subscription or failed renew
Default event name: [Apphud] promo_expired
Parameters:
product_id
: Stringoffer_id
: Stringreason
: Stringoffer_type
: String
Refund during promotional offer
Default event name: [Apphud] promo_refunded
Parameters:
product_id
: Stringoffer_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatreason
: Stringoffer_type
: String
Other Events
Non renewing purchase
Default event name: [Apphud] non_renewing_purchase
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Float
Non renewing purchase refunded
Default event name: [Apphud] non_renewing_purchase_refunded
Parameters:
product_id
: Stringlocal_price
: Floatcurrency
: Stringusd_price
: Floatreason
: 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
Updated 8 months ago