Blog


Empower Your Adserver with Content Programming

Content Delivery Limitation Plugin works with meta description of web pages. At times, you may want more flexible than that. For example, you may want to match ads based on dynamic content, or you may want to match ads based on content in a mobile app. Here, I would show you how to empower your ad server to do that.

First, download ContentProgramming.zip and unzip it. It has two files: asyncfn.js and asyncfnjs.php. Copy them to your revive ad server's www/delivery folder, i.e., assuming your revive ad server is www.youradserver.com/revive, then, copy the two files to www.youradserver.com/revive/www/delivery folder.

Add asyncfnjsjs="asyncfn.js" to [file] section in xxx.xxx.xxx.xxx.conf.php of your adserver. Your conf.php will look like this

Your ad server is ready for content programming.

Now, for a web page to do content programming, you need to modify the invocation tag as follows:

<ins data-revive-zoneid="2" data-revive-id="117dadc085810cb156b98c91b758833b"></ins>
<script async src="//www.youradserver.com/revive/www/delivery/asyncfnjs.php"></script>

The only difference of the above code from the revive server auto generated invocation code is the file name of src: asyncjs.php is changed to asyncfnjs.php.

Drop the tag to a web page. In the page, call javascript function revivefn as follows:

revivefn(document, window, "Drink to Your Health (in Moderation), the Science Says. Abstaining is sound advice because of the dangers of abuse, but moderate drinking is linked to some positive results.");

Of course, it is your (programmer's) decision that when to call the function and what to pass to it. For example, NYTMostViewed lists most viewed articles of New York Times. When an article link is clicked, the title and the abstract of the article are passed to the function. The matched ad is displayed, then.

Posted by Gary Guo on June 28, 2016