Archive for the ‘OpenX’ Category

OpenX displaying wrong statistics

I have seen some strange results when running the website report – one zone is showing more than one million clicks but only three impressions. The issue is quite serious because you cannot compute the clickthrough rate. First I thought that is an OpenX bug especially after that I discovered some strange data in the ox_data_summary_ad_hourly table – a very large number of lines having zone_id equal with zero.

After digging in the code and thinking twice I remembered that I modified the original code for displaying the ads..so I used Charles in order to check if the invoked url’s. I discovered that the call used to log an impression was something like server/www/delivery/lg.php?bannerid=10&campaignid=9&zoneid=4. It seemed that by mistake I used “&” instead of “&” and the campaignid and zoneid parameters were lost. Because OpenX was not able to find the zoneid it inserted lines having the zone_id equal with zero.

The problem was solved – the idea is to never log an impression without setting the zone_id..or better to patch the OpenX code in order to properly check the preconditions – I would have been able to identify problem way earlier in this case.

OpenX – enabling advanced reports on CentOS

I’m using CentOS for my cluster and I discovered that I’m not able to run the advanced reports from OpenX – I received the following error: “Using an input encoding requires PHP support for mb_convert_encoding() and mb_strlen()”.

The solution is quite simple: you need to install the Php multibyte string library. The command for doing that is “yum install php-mbstring”

 

Invoking OpenX api from Flex

For the last several months I was playing with OpenX, an open source ad server written in PHP.  You can interact with OpenX in two ways: first by using the admin graphical interface, second by using API calls – most of the UI functionality can be programmatically reproduced.

OpenX is exposing its API through XML-RPC and they have a couple of examples on their website how to invoke the API from PHP, Java and Ruby. In my case I was trying to display some statistics without going through a middleware, so I started to investigate how can I do it from Flex. It turned out to be quite easy – one can use the AS3 RPC written by Akeem Philbert, with a small modification. The following steps should be done:

a) download the source code of the library from this location (http://code.google.com/p/as3-rpclib/)

b) you have to fix a small issue in the class com.ak33m.rpc.xmlrpc. XMLRPCObject  (compatibility issue between SDK’s). The overloaded methods setCredentials and setRemoteCredentials should receive another parameter, called charset.

c)create the objects mapping the OpenX structures (advertiser, campaign, zone etc) and invoke the exposed methods

I did these steps and I created this Flash Builder project – you can import it into your workspace and change the file ServerConfig.as accordingly.

In my example I have just a couple of operations like login, displaying and creating advertisers. It can easily be extended in order to support the whole OpenX api.

Next post on OpenX will be about displaying the ads on your website, from Flash and HTML.