Custom Plugin: Generic Instructions

5 February 2016 by admin

Implementing the Yavli plugin part is very simple. You need to accomplish three things:

1. Download JS code from our API in a script.

Create a script that can download the code from our API server. You will need to know your credentials: WebsiteID and ApiKey. Please request these from us if you have not already received them.
Replace [WebsiteID] and [ApiKey] with your given credentials in the following URL:


http://api.yavli.com/v2/get-ad-server?X-WebsiteID=[WebsiteID]&X-ApiKey=[ApiKey]&raw=1

Now create a script that loads this URL, and stores the results somewhere locally (eg. in a database).

 

Note: Please do not trigger your download script above directly in your website, that will make your website re-download the JS from our API on every load.

2. Put the download-script above into cron (or other scheduler).

Place the download-script you create above into cron, and execute it once per hour.

3. Publish the JS code on your website.

Add the JS code which the script above downloads into your website. Please place it right above, or close to, your closing body tag:


<!-- Place the JS code here -->
</body>

You can download a sample PHP implementation of this plugin by clicking here.