Categories

Archives

Syndication


Ajax advertising magic

29
Sep
Posted in Internet

There have always been a problem of advertising systems when you pay for pageviews instead of adviews.
It can be a scenario when you buy advertising on a site where they have 200k pageviews a month for $50. Great deal you think for yourself but when the campaign has started you don’t get any visitors coming since your ad has been placed so well-folded that no one ever sees it.

Your ad was placed in the very footer of the site and all the content is placed on the first half of the page which means that the site may get 200k pageviews but your ad is only shown for those who scroll down to the bottom of the page.

It’s here the ajax magic comes into play. With a piece of ajax code you can actually record how many REAL views your ad get and not how many pageviews the site has.

To show this, we have put up a .html site with the code added where you can see how it works. There is no hocus pocus about this, it’s real!
http://cdsrc.com/uploads/adajaxmagic.html

For those who not dare to click it, you can see the code here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<html>
<head>
 
</head>
<body>
<div id="status" style="position:absolute; left:150px; top:300px; border:4px solid black;">Status div</div>
<div id="content" style="height:100%; width:400px;border:4px solid orange;">Hello, this is the main content</div>
<div id="content2" style="height:20%; width:400px;border:4px solid lightgreen;">Some more content</div>
<div id="adhead" style="width:100px; border: 1px dotted black; height: inherit;" > 
<div id="ad" style="width:100px; height:inherit; border:1px dotted green;"></div>
</div>
<script type="text/javascript">
function findPosY(obj)
{
  var curtop = 0;
  if(obj.offsetParent)
      while(1)
      {
        curtop += obj.offsetTop;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.y)
      curtop += obj.y;
  return curtop;
}
 
 
function findAdCallback() {
	adRef = document.getElementById('ad');
	statusRef = document.getElementById('status');  
 
	statusRef.innerHTML = 'Ad is not shown';
	if ((document.body.clientHeight+document.body.scrollTop)>findPosY(adRef)) {
		statusRef.innerHTML = 'Ad is shown partly';
	}
 
	if ((document.body.clientHeight+document.body.scrollTop)>(findPosY(adRef)+adRef.clientHeight)) {
		statusRef.innerHTML = 'Ad is shown completely';
		}
 
 
 
}                                        
adCallbackId = window.setInterval('findAdCallback()',500); 
adRef = document.getElementById('ad');
adRef.innerHTML = 'This is a fat ad<br/>Ad ad ad ad';
</script>
 
</body>
</html>

You see, it wasn’t that extreme!
Use the ideas wisely!

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Technorati
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Furl
  • Netscape
  • De.lirio.us

Leave us a comment