Guides
GuidesLog In
Guides

AppMetrica

This guide describes how to add and configure AppMetrica integration.

AppMetrica is a free real-time ad tracking and mobile app analytics solution.

Limitation

Apphud Events doesn't show up as Revenue due to limitations of their S2S API. You can view Apphud Events only in the Events page under Reports tab.

However, we include the following custom parameters that might work for you: usd_price and local_price.

How to Add Integration?

Step 1

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.

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())
}
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.

📘

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: 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

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: 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

Regular

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

Promo Offer

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

Other Events

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