The Doceree Publisher Tag (DPT) is an ad-tagging library for ‘Doceree for Publisher’ program which is used to dynamically build ad requests. It takes key details from you (such as ad unit code, ad size, and custom targeting), builds the request, and displays the ad on web pages. Placing a tag on a page creates a communication path between the ad server and a user’s browser
The following example walks you through the process of creating an Ad slot that uses DPT to load an Ad from Doceree's ad network
To start the integration process, please log in to your account and click on the ‘Add Slot’ tab on the left Navigation Bar
STEP 1 – Basics
Slot Type: Select the type of ad slot. At the moment, we only offer display Ads, but we will soon be launching video ads and email ads as well
App Name: This shows your app, where the ads will be displayed. This section will be prepopulated
Slot Name: Enter the slot name to identify your ad slot
STEP 2 – Details
Slot Dimension:
You need to select the dimensions of the ad slot that you are registering. This will help in ensuring that only the right ads (of right dimensions) are pushed on this slot. We currently support all 5 standard app ad sizes
STEP 3 - Bid Range
CPM Bid Range:
Here, you can set the CPM bid range. Though we offer a suggested bid range, you may choose to set it lower or higher based on what you think is the right amount
CPC Bid Range:
Set the CPM bid range. Though we offer a suggested bid range, you may choose to set it lower or higher based on what you think is the right amount
Step 4 - Ad Slot Integration
Add DocereeAdView to the layout:
The easiest way to do this is to add one of the corresponding XML layout files using the code created. Copy and paste the code at the relevant place on your app. Alternatively, you can add this view programmatically (using the example code shown below)
Load an Ad:
That is done with the loadAd() method in the AdView class. Use the code example that shows how to load an Ad in the onCreate() method of activity when the view is made via XML
Ad events
To further customize the behavior of your ad, you can listen to a number of events in the Ads lifecycle like loading, opening, closing etc. You can listen to these events through the DocereeAdListener class,
docereeAdView.loadAd(adRequest, new DocereeAdListener(){
@Override
public void onAdOpened() {
super.onAdOpened();
Log.d(TAG, "ad opened");
}
@Override
public void onAdClicked() {
super.onAdClicked();
Log.d(TAG, "ad clicked");
}
@Override
public void onAdClosed() {
super.onAdClosed();
Log.d(TAG, "ad closed");
}
@Override
public void onAdLoaded() {
super.onAdLoaded();
Log.d(TAG, "ad loaded");
}
@Override
public void onAdFailedToLoad(String message) {
super.onAdFailedToLoad(message);
Log.d(TAG, "ad failed to load");
}
});
Each of the overridable methods in AdListener corresponds to an event in the lifecycle of an Ad.
Overridable methods | Description |
onAdLoaded() | The AdLoaded method is called when the Ad has finished loading |
onAdFailedToLoad() | The onAdFailedToLoad(String message) is the only method which is called when an Ad has failed to load with an error message |
onAdOpened() | This method is invoked when the Ad is clicked |
onAdClosed() | When a user returns to app after viewing the Ad's click through link then this method will be invoked |
Comments
0 comments
Please sign in to leave a comment.