-
Notifications
You must be signed in to change notification settings - Fork 0
Listening for Ad Events
awallace87 edited this page Aug 23, 2016
·
1 revision
For each Placement View a publisher has the option to attach a listener to the page view in order to be notified of major events associated with the ad request.
Here is how you can add a listener to a Placement View:
YMPlacementView.Builder builder = new YMPlacementView.Builder(context);
builder.placementId(YMConstants.hyperscrollerPlacementId);
//Attach anonymous YMPlacementListener to Placement View
builder.listener(new YMPlacementListener {
@Override
public void adDisplayFailed(YMException exception) {
}
@Override
public void adDisplayed() {
}
@Override
public void adLeavesApplication() {
}
@Override
public void adClicked() {
}
});
view = builder.build();You can also use your own custom implementation of the YMPlacementListener interface, which is as follows:
public interface YMPlacementListener {
void adDisplayFailed(YMException exception);
void adDisplayed();
void adLeavesApplication();
void adClicked();
}-
adDisplayed(): called when an ad is successfully loaded and added to the YMPlacementView -
adDisplayFailed(YMException exception): called when an ad request/display fails. Theexceptioncontains a message detailing the failure reason. -
adLeavesApplication(): called when an action from the advertisement leads to the user being directed from the application. -
onAdClicked(): called when a user clicks on an advertisement.
- Home
- [Key Terms](Key Terms)
Start Here
- Integration
- Doubleclick for Publishers
- [Before you Launch](Before You Go Live)
- [Listening for Ad Events](Listening for Ad Events)
- Additional Settings
- [Page View](Page View)
- [Custom Content Frame](Content Frame)
- Proguard
Have a previous SDK?
- [Upgrade Guide](Upgrade Guide)