Installation
- Add ads.js in the page you want to display the ads.
<script src="https://www.yourdomain.coom/ads.js"></script>
- For each ad you want to show in the page, you need to add a div with a data-target="ad" tag. Style the div with the width and height you want it, the script will automatically cycle through them, grab their width and height and serve an ad accordinly.
<div data-target="ad"></div>
- If you want to configure to serve "restrict" or "adaptative" ads, set in the div as well with the "data-mode" tag. A "restrict" ad mode only rotates through images with the same size of the div. An "adaptative" ad mode rotates through all banners and tries to allocate the image in the middle of the div in the best possible way. The default mode is configured in the config.inc.php file.
<div data-target="ad" data-mode="adaptative"></div>
- The default is always to open up the link in a new tab, if you want to open up in the same tab, set the "data-new_window" tag as "false".
<div data-target="ad" data-mode="adaptative" data-new_window="false"></div>
Configuration
- Open up the inc/config.inc.php file to configure it as you wish:
- $config['url']
Default destination URL for all banners.
- $config['mode']
The default mode for serving the ads when the "data-mode" tag is not set.
- $config['allowed']
If you add hosts to this array, only these hosts will be able to show ads. Configure the hosts simply as "yourdomain.com", never with "https://" or "www".
- $config['urls']
Specific URLs for images, will use this is set instead of $config['url']. Always use the correct image name, with the extension and respecting the case.
- $config['location']
Locations for the images and for where the SQLite should be saved as well. The image location should be public as well.