Before implementing an ad space into your website, you should know how ADvantage works.
Note: We highly recommend the use of a factory class instead of implementing the whole structure for each ad space you implement. A factory class can reduce the implementation and also maintainance time.
Initialize the ADvantage object¶
With the license key and the ad positions acquired from us, you can initialize the ADvantage object. The license key will be validated for each ad request.
Requesting and showing the ad¶
The SDK is requesting the ad from the ad server. Through different callback methods you will be notified if the ad server has a campaign which you have to show or not. If the ad is requesting a layout update, or in the case of an error, you will be notified.
Dispose the ADvantage object¶
Destroying the ADvantage object in a correct way is very important. Otherwise, the ADvantage instance and the advertisement remains in the background and consumes CPU and other resources. In the worst case scenario it could lead to memory problems. Therefore, you must destroy the ADvantage instance on AJAX pages. On a websites, where the DOM of the HTML is fully reloaded on a page change, it is not necessary to destroy the ADvantage instance manually since the browser takes care of this.
Before destroying the ADvantage object
Before calling the
destroy() function, it is important to remove all of your ADvantage-related event listeners.
//destroy the ADvantage object banner.destroy();
The destroy method will remove all event listeners, intervals and the ADvantage DOM Node of the current instance, which is created by the ADvantage SDK.
Re-initializing ADvantage instance
If you are going to show advertisements after destroying an ADvantage instance, you should re-initialize the given instance.