Creating an advertisement system for your web sites (my own AdSense)

9.1k views Asked by At

I do not know the right term for this but say I want to have Ads on my web sites where there advertisers need to pay whenever users click on the web sites. How should one go about doing this?

My approach is to link the Ad to a script file that will record the click in a database and redirect the user to the advertiser's site. I see one weakness with this; the same user can click the Ad multiple times within a timeframe and multiple clicks will be recorded.

So to avoid that, I am thinking of setting a COOKIE for each visitor and each visitor's click will be recorded only once in a day. (But what if cookie is disabled).

What is the right way to set up an advertisement system like this on a web site? Can you share your methodologies?

3

There are 3 answers

1
Matt Williamson On BEST ANSWER

You could record the user's ip address in cache or in the database to prevent multiple clicks in a one day period.

1
Byron Whitlock On

Advertisers need to have total trust that you are giving them the right numbers. That's why the ad space is dominated by the likes of doubleclick, google and other behemouths. I'd make sure you can fill your ads by doing some market research before worrying about the technical aspect.

Assuming you have already done this, you can indeed use a cookie.

You can also serve a unique URL with every ad. So if the same URL is clicked twice, then you know a user is clicking the same ad twice.

Even if you have only 1 ad on your site, it would always have a GUID or something attached so you know it was a unique click.

Good luck.

1
Ayaz Alavi On

I recently created such a system, please view its promotion site textsensor.com. So how do we do that, you need to keep these points in mind

1) Cross domain ajax is not allowed so no sending data to your server when some user click on a ad that could be present in website of any of the publisher and you might got them in thousands.

2) Cookies might be blocked like you said, also different browsers might cause different sort of trouble :) when you deal with cookies in such scenarios .

3) You need to provide publisher with script tag that they will embed ads on there website for relevant keywords.

4) This tag must be executing server side programming language. for example

<script src="http://dennis.com/ads_application/get_my_ads.php">

OR if you have multple php files then include 1 js file that will import all php files into the website for example

    <script type="text/javascript" src="http://www.dennis.com/ad_application/inline.js">
</script>

5) you need to tell server about publisher, so put there id and there campaign id inside script tag and put that script tag before inline.js file from stop 4.

<script type="text/javascript">
 var ad_publisher = "5122";
 var ad_campaign = "11129";
 var ad_type = "inline";
</script> 

6) you need to check whether current host is eligible for putting ads on there website

7) you can view sample inline.js file here we made for textsensor.com

8) For creating interval between when last user clicked on an ad, you need to record that user using there ipaddress and by creating cookies. that must be done on server side, that is send ipaddress to the server and time user clicked on the ad.