Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 259
denniss Avatar asked Aug 17 '10 06:08

denniss


People also ask

Do I need my own website for AdSense?

To use AdSense, you must have access to the HTML source code of your site. You need to be able to place AdSense code between the <head> tags of your pages. If you sign up with a site you don't own (e.g., www.google.com), we won't be able to verify that you're the site owner and we won't activate your account.

Can I monetize my website with AdSense?

Pay Per Click Advertising with Google AdSense The website owner can quickly and simply place ads on the blog or website. Another great thing is that you can still apply to be an AdSense partner even if you have multiple sites.


2 Answers

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.

like image 180
Ayaz Alavi Avatar answered Sep 30 '22 13:09

Ayaz Alavi


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

like image 35
Matt Williamson Avatar answered Sep 30 '22 13:09

Matt Williamson