Sending Ad Revenue on Flutter

Testing and manually sending purchase information

AppMetrica doesn't let you segment Ad Revenue into "test" and "not test". If you use the main API key for debugging the collection of data on advertising monetization, the test events are included in general statistics. If you need to debug sending Ad Revenue, use a reporter to send statistics to an additional API key.

Step 1. Create a test app in AppMetrica

Specify the app parameters: link in the app store (if the app isn't published yet, leave the field empty), name, category, and time zone for generating reports.

To add another app, click Add app in the drop-down list in AppMetrica.

Step 2. Test sending Ad Revenue

This section outlines the steps for sending Ad Revenue to the additional API key:

  1. Create a PluginErrorDetails class object.

    Map<String, String> adRevenuePayload = {
        "payload_key_1": "payload_value_1",
        "payload_key_2": "payload_value_2"
    };
    
    AdRevenue adRevenue = AdRevenue(
        adRevenue: Decimal.parse("100.100"),
        currency: "USD",
        adNetwork: "ad_network", // Optional
        adPlacementId: "ad_placement_id", // Optional
        adPlacementName: "ad_placement_name", // Optional
        adType: AdType.NATIVE, // Optional
        adUnitId: "ad_unit_id", // Optional
        adUnitName: "ad_unit_name", // Optional
        precision: "some precision", // Optional
        payload: adRevenuePayload // Optional
        );
    
  2. Send the AdRevenue object to the test API key using the reporter.

    AppMetrica.getReporter("TEST_API_KEY").reportAdRevenue(adRevenue);
    

Step 3. Make sure that Ad Revenue info is shown in reports.

  1. View ads in the app.

  2. Make sure that the Revenue report shows the same number of Ad Revenue events as the number of ad views.

Step 4. Set up sending Ad Revenue to the main API key

  1. Make sure that the SDK is activated before sending data to the main API key. Activation example:

    AppMetricaConfig config = AppMetricaConfig("API_KEY");
    AppMetrica.activate(config);
    
  2. After debugging, repeat steps 2 and 3 for the main API key.

  3. To send the AdRevenue object to the main API key, use the reportAdRevenue(AdRevenue); method.

    AppMetrica.reportAdRevenue(adRevenue);
    

If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.

Contact support