After the mapping of your inventory's structure and creation of the accompanying positions, it is time to create and implement the Adhese ad tags. Ad tags are the basis of our technology and allow us to deliver and measure targeted campaigns.
How to get started with Adhese
<head>of the page:
Provide a local function that returns the content identification:
Initialize the Adhese instance:
Implementation of the Adhese ad tag
Legacy requests are implemented as a
script fragment inside the
<div> container where they will be visualized. The client executes the request and inserts the response in the
<div> container with a
document.write statement. However, this implementation method is not recommended if you want to take advantage of viewable tracking and forecasting. It also has performance drawbacks, as the client's document build-up will block while requesting an online ad.
For each ad you want to serve on a web page, you should create a
<div> container with a unique
id that is the same as the requested format and then makes a call to a the
Asynchronous JSON and JSONP requests
Asynchronous requests allow you to perform a request first and visualise the response later. The implementing client is responsible for correct reporting.
The implementation method with JSON or JSONP makes it possible to bundle all advertisements in one request and visualize the creative in the right place. With this method, it is easy to take into account the moment when the creative has a true change to be seen, better known as viewability. This implementation method is the most suitable and favorable method to use in a responsive environment.
A tracker URL that is passed in the response should be requested when visualizing the ad. The code can be built with an extra AJAX request handler. If you plan to implement in a client that is already capable of performing asynchronous requests, you can omit this part of the SDK from the dist file by running 'make noajax'.
The next piece of code is a basic ad tag that tells the client to continue loading everything else on the page while it waits for the leaderboard ad creative request. This ad tag needs to be pasted between the HTML
<body> tags, in the position where you want the leaderboard ad to be served.
The above script also allows you to simultaneously load all your ad creatives at once: the leaderboard, banner and skyscraper ad. Next to this code, you still need a code that put the ads at the right position.
Video integration with VAST
The Adhese Vast JS library is meant to ease the integration of VAST ads in video players. It contains cross-domain safe methods for requesting ads from your Adhese account as well as convenience methods for playing and tracking video ads. It is however not a player on its own and it does not insert anything in the DOM.
Register a listener for the ADS_LOADED event fired by
AdheseVastWrapper. The first parameter is the event name, the second is the name of your callback function. This function will be called when the wrapper is ready for handling your ad request.
Initiate a request for ads passing the host of your Adhese account and the sloth path and target parameters you wish to request.
- Once the request is finished,
AdheseVastWrapperwill fire the ADS_LOADED event and your callback function wil be called. From then on you can access several properties of the wrapper object to get info on the ads.
This is a complete example:
Adhese recommends the use of IAB SafeFrame standard where possible. Adhese supports SafeFrame by default. To turn off, initialize your Adhese instance with the
safeframe option set to false.