AppMetrica
This guide describes how to add and configure AppMetrica integration.
AppMetrica is a free real-time ad tracking and mobile app analytics solution. Send Apphud subscription and purchase events to AppMetrica, analyze user behavior, and make decisions based on actual revenue data.
How to Add Integration?
Step 1 - Install the SDKs
- Install Apphud SDK.
- Install AppMetrica SDK.
- Match User IDs between AppMetrica and Apphud. See below.
Step 2 - Preparations in AppMetrica
Open AppMetrica and go to Settings of your app. Copy the Application ID and Post API Key fields (not the API key!).
Step 3 - Authentication
In Apphud, open Connections → Integrations (the All or Product Analytics tab). Click Add Connection for AppMetrica and choose a Source (iOS, Android, or Flows) in the pop-up.
In the configuration window, specify the connection Name and enter:
- Post API Key (required) — copied in Step 2.
- Application ID (required) — copied in Step 2.
Step 4 - Additional configuration
Revenue
AppMetrica-specific revenue option:
- Send revenue properties — when ON, Apphud reports revenue to AppMetrica along with generic events. Leave OFF if you don't want Apphud to send revenue data to AppMetrica.
Generic Environment and Send sales as proceeds settings are described once on Integrations overview → Configuration tab.
Set up filters (optional)
Navigate to Filters tab. Set up filters if needed as described on Integrations overview → Filters tab.
Step 5 - Set up Events list
Open the Events tab of the configuration. You can enter custom event names or disable some.
Step 6 - Test connection (optional)
Save the connection.
For the general Test connection flow see Integrations overview → Test connection.
Step 7 - Enable and save connection
Once you confirmed the connection works — Enable integration and click Save.
Match User Ids
Important NoteYou must set the AppMetrica User Profile ID by matching with the Apphud User ID before sending any events. Otherwise, events may appear as "sent successfully" in Apphud logs but won't show up in AppMetrica because user matching fails.
Here is an example of initializing both SDKs with User IDs matching:
import AppMetricaCore
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Apphud.start(apiKey: "YOUR_API_KEY")
Apphud.setDelegate(self)
if let configuration = AppMetricaConfiguration(apiKey: "806e8e7b-8549-4164-a996-e6936590c676") {
AppMetrica.activate(with: configuration)
AppMetrica.userProfileID = Apphud.userID()
}
return true
}
// implement ApphudDelegate
func apphudDidChangeUserID(_ userID: String) {
// Match again
AppMetrica.userProfileID = Apphud.userID()
}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)Apphud.start(apiKey: "YOUR_API_KEY")
YandexMetricaConfig config = YandexMetricaConfig.newConfigBuilder(API_key).build();
YandexMetrica.activate(getApplicationContext(), config);
YandexMetrica.setUserProfileID(Apphud.userId());
YandexMetrica.enableActivityAutoTracking(this);Future<void> _initAppMetrica() async {
final userId = await Apphud.userID();
final config = AppMetricaConfig(
'insert_your_api_key_here',
userProfileID: userId,
);
await AppMetrica.activate(config);
}Events Cheat Sheet
This is a list of all possible events and their parameters that are being sent to AppMetrica.
NoteYou 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 16 days ago
