1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Want to sell ad space per impressions/clicks - what script to use?

Discussion in 'General Business' started by super, May 23, 2009.

  1. #1
    what title says... want to sell ad space on my sites, but have no idea what script (to count impressions or/and clicks) should I use..
    thanks
     
    super, May 23, 2009 IP
  2. ViciousSummer

    ViciousSummer Ayn Rand for President! Staff

    Messages:
    3,210
    Likes Received:
    526
    Best Answers:
    0
    Trophy Points:
    308
    #2
    ViciousSummer, May 23, 2009 IP
  3. SSANZ

    SSANZ Peon

    Messages:
    861
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    inclick ad server has worked pretty well for me :)
     
    SSANZ, May 23, 2009 IP
  4. mentos

    mentos Prominent Member

    Messages:
    15,280
    Likes Received:
    473
    Best Answers:
    0
    Trophy Points:
    330
    #4
    I used self made script coz it effective

    Bear in mind that this code is an example of how to create a script that counts all impressions done by humans. Since robots don’t execute JavaScript code, only human impressions count.

    Firstly create the table in your MySQL database by executing this query:

    CREATE TABLE IF NOT EXISTS `days_impressions` (
    `day` date NOT NULL,
    `impressions` int(11) NOT NULL,
    PRIMARY KEY (`day`),
    KEY `impressions` (`impressions`)
    )


    Then open your text editor and place this code:


    <?php
    $server = “localhost”;
    $user = “user”;
    $dbase = “database”;
    $passwd = “password”;

    $days_impr = “days_impressions”;

    //function that reports fatal errors in MySQL instead of showing them as output
    if (!function_exists(’fatal_error_report’))
    {
    function fatal_error_report($line,$file)
    {
    //fatal_error_report(__line__,__FILE__);
    $to = “bugs@yourserver.com”;
    $subject = “Fatal error”;
    $ip = $_SERVER[’REMOTE_ADDR’];
    $messaget= ‘<html><body><h1>Fatal error has occured</h1><br />Details:<br />’.$file.” on line “.$line.” with this error “.mysql_error().’<br />Page accessed: <b>’.$_SERVER[’REQUEST_URI’].’</b>. IP: <b>’.$ip.’</b></body></html>’;
    $postmast= “postmaster@yourserver.com”;
    $headers = “From: “.$postmast. “\n” .
    “X-Mailer: PHP/” . phpversion() . “\n” .
    “MIME-Version: 1.0\n” .
    “Content-Type: text/html; charset=utf-8\n” .
    “Content-Transfer-Encoding: 8bit\n”;
    mail($to, $subject, $messaget, $headers);
    die ();
    }
    //end of error reporting function
    }

    $link = mysql_connect($server, $user, $passwd)
    or fatal_error_report(__line__,__FILE__);

    mysql_select_db($dbase)
    or fatal_error_report(__line__,__FILE__);

    $date = date(”Y-m-d”);

    $found = 0;
    $result = mysql_query(”select * from $days_impr where day = ‘$date’ limit 1;”, $link)
    or fatal_error_report(__line__,__FILE__);
    if (mysql_num_rows($result))
    while ($qry = mysql_fetch_array($result))
    $found = 1;

    if($found==1)
    {
    $result = mysql_query(”update $days_impr set impressions = impressions + 1 where day = ‘$date’ limit 1;”, $link)
    or fatal_error_report(__line__,__FILE__);
    }
    else
    {
    $result = mysql_query(”insert into $days_impr values ( ‘$date’ , ‘1′)”, $link)
    or fatal_error_report(__line__,__FILE__);
    }

    mysql_close();
    ?>

    Don’t forget to modify these variables’ values:

    $server, $user, $dbase, $passwd, $postmast, $to


    Once you have done this, save the file as, for example, “stats.php”. Then place this code in all pages that are available to visitors:

    <script src="http://www.yourserver.com/statistics/stats.php" type="text/javascript">
    </script>
     
    mentos, May 23, 2009 IP
  5. super

    super Well-Known Member

    Messages:
    1,019
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    130
    #5
    Nice piece of code, thanks
     
    super, May 28, 2009 IP
  6. George Arun

    George Arun Member

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #6
    Did u purchase any scripts... Or u developed one for yourself.
     
    George Arun, Jan 24, 2014 IP
  7. Amarkolom

    Amarkolom Active Member

    Messages:
    186
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    88
    #7
    Nice helping post Mentos , thanks i hope i can use it for my site. Actually this topic is new to me , but my hope is high :)
     
    Amarkolom, Jan 26, 2014 IP