3 Replies - 1114 Views - Last Post: 02 August 2011 - 11:44 PM

#1 glen75  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 02-August 11

How to make a CPM program banner with JS

Posted 02 August 2011 - 02:48 AM

Hi all,

I want to make a banner with size : 425*60 leaderboard.but i don't know to create the banner with Javascript and bring all client side data such as : traffic,impression and ip address to my PHP server side processing page and then update entire data to my database.

this is the sample script for CPM/CPC program banner :

<script type="text/javascript" language="Javascript">
aj_server = 'http://vidasco.rotator.hadj7.adjuggler.net/servlet/ajrotator/'; aj_tagver = '1.0';
aj_zone = 'vidasco'; aj_adspot = '117727'; aj_page = '0'; aj_dim ='59638'; aj_ch = '59378'; aj_ct = ''; aj_kw = '';
aj_pv = true; aj_click = '';
</script><script type="text/javascript" language="Javascript" src="http://cdn.hadj7.adjuggler.net/banners/ajtg.js"></script>


i don't get with this script meaning and how can i get all client data to my server page.can you tell me what is the algorithm to build this system ?

thanks for your help master

Is This A Good Question/Topic? 0
  • +

Replies To: How to make a CPM program banner with JS

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: How to make a CPM program banner with JS

Posted 02 August 2011 - 05:40 AM

Generally for advertisements, they would get output into your page as something like this:

<a href="http://domain.com/ads/tracker.php?adid=4"><img src="http://domain.com/ads/images/4.png" alt="Advertisement 4" /></a>


In tracker.php, you do all of your tracky stuff, and eventually redirect out to the target page.

This is how the data gets to your server, tracker.php has full access to everything on the client side just as the first page execution would, in addition to the advertisement number so you can do some specific click tracking.
Was This Post Helpful? 0
  • +
  • -

#3 glen75  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 02-August 11

Re: How to make a CPM program banner with JS

Posted 02 August 2011 - 09:58 PM

sorry i'm newbie with javascript

<a href="http://domain.com/ads/tracker.php?adid=4"><img src="http://domain.com/ads/images/4.png" alt="Advertisement 4" /></a>


yes the code above is just give me some tracked clicks if my publisher's visitors click my ads.however it doesn't tracking the traffic and impressions if the visitors just come without click my ads.i think i must put a simple javascript code on my publisher's page to get some client data directly like traffic and impressions to my php processing page.

perhaps i can put the php code directly on my publisher's page to track all data such traffic,impressions and ip address to my database.but it will be dangerous because i must show my connection data like this :
<?php

    mysql_connect("localhost","username","password");
    mysql_select_db("database_name");

$ip = $_SERVER['REMOTE_ADDR'];
//get traffic
//get whois

?>


i can't do this,how to cover my php script ?
Was This Post Helpful? 0
  • +
  • -

#4 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: How to make a CPM program banner with JS

Posted 02 August 2011 - 11:44 PM

Again you don't need to use Javascript for this, nor do any serious trickery..

You could change my small snippet above to this:
<a href="http://domain.com/ads/tracker.php?adid=4"><img src="http://domain.com/ads/display.php?adid=4" alt="Advertisement 4" /></a>


display.php will be ran, will store the impression, and then display the image, something like this:
require_once 'db.php';
$db->insert('impressions', array($_GET['adid'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT']));

header('Content-Type: image/png');
readfile('images/' . $_GET['adid'] . '.png');


Note that this script is not at all secure and shouldn't be copied/pasted (not that it could be anyway)! But you should get the general idea.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1