Supported ad types
- Image banners
- PHP >= 5.2
This solution has a frontend and backend scripts (frontend_loader.js and backend_loader.php) that have to be hosted on your server. See the latest version available : https://github.com/EXADS/exads-adblock/releases
Important note: backend_loader.php needs access to cookies that are created on frontend, so it should be hosted on the same domain (host) as the page where you are placing the addZone code.
The code can be downloaded like this:
$ wget -q https://github.com/EXADS/exads-adblock/archive/v2.0.tar.gz $ tar -xf v2.0.tar.gz $ rm v2.0.tar.gz
Displaying on page
These lines have to be added once on the page (somewhere on top of <body>, above any ad zones that you want to add):
The following code is to declare an ad zone, put it in DOM where you want the zone to be displayed. You can add multiple banner blocks like this on page.
To add a banner do the following (make sure to replace the value for idzone with your zone id, and the corresponding values for width and height):
To add a popunder:
Add this to serve the ads on page, after all the addZone declarations.
You can change the name of frontend_loader.js and backend_loader.php on your server to any random name. Keep in mind to also modify them in the calls you put on the page.
There are some constants defined in backend_loader.php It's recommended to keep them as they are, but in some cases it can be useful to change some of the configurations.
- CONNECT_TIMEOUT - the timeout in seconds used for curl requests.
- ALLOW_MULTI_CURL - when possible, script tries to use curl_multi_exec. If this is a burden on cpu - this can be turned off.
If you have XCache or APC on your web-server these could be useful:
- CACHE_INTERVAL_BANNERS - cache lifetime for banner images (in seconds), if set to 0 images will NOT be cached.
- CACHE_KEYS_LIMIT_BANNERS - the limit for number of allowed banner images to store in cache (to not overuse publisher resources), if set to 0 there will be no limit, so all the images will be cached.
- Keep abreast of ongoing changes and updates by checking out the project CHANGELOG