Tracking installations from Facebook

Attention. AppMetrica doesn't support Instagram, Audience Network, and Messenger advertising campaigns tracking.

You can use AppMetrica to track installations from Facebook ad campaigns. To do this, you need to use tracking links with deeplink.

However, AppMetrica reports show only the number of installations. The number of clicks and conversion to installations are not displayed, because when you click on an ad in Facebook, the user is sent directly to the app store, bypassing the redirect service.

To track installations from Facebook ad campaigns, follow these steps:

  1. Step 1. Prepare your app
  2. Step 2. Create a tracker
  3. Step 3. Create a Facebook advertising campaign

Step 1. Prepare your app

  1. Integrate the AppMetrica SDK. For more information, see Installation and initialization.
  2. Add deeplink support to your application. For more information, see Android documentation.
  3. Integrate the latest version of the Facebook SDK. For more information, see Facebook documentation.
  4. Test the Deferred Deep Link using App Ads Helper in Facebook.
  5. To get deeplink when installing the app, use the AppLinkData.fetchDeferredAppLinkData(Context, CompletionHandler) method:
    AppLinkData.fetchDeferredAppLinkData(this, new AppLinkData.CompletionHandler() {
        @Override
        public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) { 
            // Sending information about the deeplink to AppMetrica.
            YandexMetrica.reportReferralUrl(appLinkData.getTargetUri().toString());
            // Redirecting via deeplink.
            ...
        }
    }
    Copied to clipboard
    For already installed application start, use the AppLinkData.createFromActivity(Activity) method. Add the following code to the onCreate method of the Activity that you are redirect to from Facebook.
    AppLinkData applinkData = AppLinkData.createFromActivity(this);
    if (applinkData != null) {
        YandexMetrica.reportAppOpen(appLinkData.getTargetUri().toString());
    }
    Copied to clipboard