Statistics Listener

Listen to placements' statistics events

Statistics Listener

StatisticsListener enables publishers to listen to all the placement-related statistics events. This might be useful e.g. to establish user-related analytics.

Set Statistics Listener for Placement

Use the following code to set the statistics listener for a specific placement:

placement.setStatisticsListener(this);

Complete Code Example

The below example can be applied to all types of placements.

private void requestAd() {
    // Setting the impression delegate for the infeed-banner placement
    inFeedBannerPlacement.setStatisticsListener(this);
    BannerRequest request = new BannerRequest(this);
    inFeedBannerPlacement.requestAd(request, (layout, error) -> {
        // Display the banner or handle the error
    });
}

// StatisticsListener implementation:
@Override
public void countedAdSpace(@NonNull Placement placement) {
    // An ad space counted
}

@Override
public void countedMediationCycle(@NonNull Placement placement) {
    // An mediation cycle counted
}

@Override
public void countedRequest(@NonNull Placement placement, @NonNull AdNetwork network) {
    // An request counted
}

@Override
public void countedResponse(@NonNull Placement placement, @NonNull AdNetwork network) {
    // An response counted
}

@Override
public void countedImpression(@NonNull Placement placement, @NonNull AdNetwork network) {
    // An impression counted
}

@Override
public void countedVimpression(@NonNull Placement placement, @NonNull AdNetwork network) {
    // An viewable impression counted
}

@Override
public void countedDirectDealImpression(@NonNull Placement placement, @NonNull AdNetwork network) {
    // An direct deal impression counted
}

@Override
public void countedClick(@NonNull Placement placement, @NonNull AdNetwork network) {
    // An click counted
}

Last updated