1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

rotating offers

Discussion in 'Black Hat SEO' started by michuricane, Dec 3, 2012.

  1. michuricane

    michuricane Junior Member

    Joined:
    Nov 14, 2012
    Messages:
    118
    Likes Received:
    5
    Is it possible to rotate offers but if you visit the page the url stay the same
    Because the thing is I rotate offers now to split test and see what convert better but when the site keep changing the person that visit the site think its fake or sth
     
  2. proweb

    proweb Regular Member

    Joined:
    Feb 24, 2011
    Messages:
    291
    Likes Received:
    144
    You can use PHP and MySQL to record both the offer and the IP address. Then when the page loads, a script checks to see if an IP address is unique and if the person has visited previously it loads the same offers they saw on their first visit.
     
  3. michuricane

    michuricane Junior Member

    Joined:
    Nov 14, 2012
    Messages:
    118
    Likes Received:
    5
    thanks you have the script?
     
  4. michuricane

    michuricane Junior Member

    Joined:
    Nov 14, 2012
    Messages:
    118
    Likes Received:
    5
    im looking everywhere cant find the script
    i need that
     
  5. proweb

    proweb Regular Member

    Joined:
    Feb 24, 2011
    Messages:
    291
    Likes Received:
    144
    I have a similar tracking script that I built so I edited it a bit for you.

    To get the code to work you need to create a database table with the values "ip" and "offer". The script will check IP addresses and grab the offer variable if the person has previously visited. You will need to implement your offer rotation code into the script.

    I would recommend having a random number determine which offer was displayed. Like if it was two offers, have the first offer display if the random number is 0 and the other offer displayed if the random number was 1. Then if the person visits the page the script below will grab the random number from the MySQL table which you can then use to display the appropriate offer.

    Code:
    <?php
    $host = "localhost"; 
    $username = "XXXXXXXXXXX";   //Set this to your mysql username
    $password = "XXXXXXXXXXXXX"; //Set this to your mysql password
    $dbname = "XXXXXXXXXXXX";    //Set this to your mysql database name
    $tblname = "XXXXXXXXXXXXXX"; //Set this to your table name
    
    $ip_address = $_SERVER["REMOTE_ADDR"]; //Gets ip address
    $offer = "XXXXXXX"  //Set this to the offer being displayed
    
    
    //******************************************
    //Sees if the visitor has previously visited the page
    //------------------------------------------
    mysql_connect ($host, $username, $password)or die("Could not connect: ".mysql_error());
    mysql_select_db($dbname) or die(mysql_error());
    
    $query="select ip from $tblname WHERE ip = '$ip_address'";  // query string stored in a variable
    $rt=mysql_query($query);          // query executed 
    echo mysql_error();               // if any error is there that will be printed to the screen
    
    $check_repeat_visitor = 0;
    if($rt){ $check_repeat_visitor = mysql_num_rows($rt);}
    
    //If visitor is unique record their IP and the offer shown
    if($check_repeat_visitor == 0){
        $viewer_new_query = "INSERT INTO $tblname (ip, offer) VALUES
                ('$ip_address', '$offer')";
        $viewer_new_result = mysql_query($viewer_new_query);
    }
    
    
    //If visitor is not unique get the offer they were shown
    if($check_repeat_visitor != 0){
        $checkHits = "SELECT offer FROM $tblname WHERE ip = '$ip_address'";
        
        $checkHitsResult=mysql_query($checkHits);
        $row = mysql_fetch_array($checkHitsResult);
        $offer = $row["offer"];
    }
    
    ?>
    PS - You can use this code either on the page itself or call it outside of the page in an external script.
     
    • Thanks Thanks x 1
  6. michuricane

    michuricane Junior Member

    Joined:
    Nov 14, 2012
    Messages:
    118
    Likes Received:
    5
    Thanks but I dont understand, how I randomize the urls?
     
  7. MrRippley

    MrRippley Newbie

    Joined:
    Apr 11, 2012
    Messages:
    14
    Likes Received:
    0
    nice, i was looking for this
     
  8. michuricane

    michuricane Junior Member

    Joined:
    Nov 14, 2012
    Messages:
    118
    Likes Received:
    5
    but it doesnt work for me
     
  9. michuricane

    michuricane Junior Member

    Joined:
    Nov 14, 2012
    Messages:
    118
    Likes Received:
    5
    I cant get the script to work