Hi guys, I currently operate a website that displays the usual banner ads. I have a forum where I want to display these ads. What I want to do, is to insert my own "javascript ad snippet" in place where an ad banner should be displayed and let it come through my own PHP script which consequently will choose the "best" ad and return right code snippet for 3rd party ads. (I realize my PHP will return JavaScript code which I got hang of). Currently it works ok for displaying straight Ad images. Now I want to track so that I only display some ads once every 24 hours per users. How would I go about doing this? My main problem is that I need to set a cookie that lasts 24 hours within my PHP script. Unfortunately, you can only set cookie before <HTML> tag, meaning by the time my PHP script is running, it is too late. I am already half way down the forum page that wants to display the ad. So how do other ad network achieve this? Obviously they can create cookies and use them somehow. Appreciate some feedback!
Other networks use javascript code which loads ads from their ad servers, so they perform additional http requests and probably set cookies when performing these requests. You can do the same or you can use openx ad-server ( http://www.openx.org/en/ad-server )
Thanks for the response. I actually have the cookie part working by creating an iframe with zero sized window (hence essentially doing what you described above). Now I am working on the part where I want to be able to figure out how many pages this user viewed in this session so far but just realized I cannot do this since I cannot insert session_start() on the forum HTML page (more like I don't want to do this). The only way I can see is to use the unique ID defined in the cookie, store it in DB, and use this as a session variable but surely there must be a more efficient way to figure this out than to use DB as a session variable. I realize I am doing essentially what XOpen is doing already but I don't want to host the full OpenX system when I only need a small subset of what it does and I am hoping it will be a bit more efficient as well as a result of this.