php url tracking script

Discussion in 'PHP' started by mbaldwin, Mar 4, 2009.

  1. #1
    Hi,
    I am looking for a tracking script, or pointed in the direction on how to code my own.

    Lets say I run 3 different e-zine ads, and I want to see which one performed better. My base site would be
    www.example.com
    To track the ads I want to do something like this
    www.example.com/tracking/ezine1
    www.example.com/tracking/ezine2
    www.example.com/tracking/ezine3

    Now, I want to track them all the way through the sign up process, cause if ezine one sends me 25000 visitors, but only 5 signups, and ezine3 sends me 15000 visitors and 20 signups, I know ezine 3 is the better ad. So, I know I need to ad something to my thank you page, that comes right after the signup to track this info. I have used a similar system, but I am tired of paying for it, and when there site has a glitch, people who click my tracking link get a 404 error, so that looks bad for me, so I want to move all this to my own server.

    I do not really want to use $_GET like this
    www.example.com/tracking.php?=ezine1
    Some places cut off anything after the ? So that will prevent me from tracking.

    I was thinking of using a script to grab the url when it came in, cause it would cause a 404 error, and then that script would extract info from that, and bring up the page that the tracking url refers to. Then set a session with the last part of the url, the ezine1, and have a hidden php script on the thank you page that would then grab that session after the person signed up.

    Does this sound like the right way to do this, or does anyone have a better way, or a script I can get.
     
    mbaldwin, Mar 4, 2009 IP
  2. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #2
    You're close to the right solution
    If you have money contact me I can build up a custom solution
     
    crivion, Mar 4, 2009 IP
  3. mbaldwin

    mbaldwin Active Member

    Messages:
    215
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    95
    #3
    i don't have money, well not much at least, that is why I was looking for advice.
    I am familiar with php and MySQL, so I am not expecting a line by line script to be handed to me, but I might have more questions when writing the code.
    Another suggestion i got was to do
    www.example.com/tracking.php?ezine1
    Then use
    
    $page = $_SERVER['PATH_INFO'];
    
    
    Code (markup):
    To get the info. I could then put that in a session, then have a php script included on my thank you page that will look for that session, and then have things copied to a table in my DB.

    f
     
    mbaldwin, Mar 5, 2009 IP
  4. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #4
    table 1
    --
    `siteid` | autoinc | primary key | int ..
    `sitename` | text
    `traffic` | text
    --
    table 2
    --
    `userid` | auto inc | primary key | int..
    `userip` | text
    `siteid` | inc (will link to table 1)
    `converted` | char(1) | default 0;
    --
    When they first get to your website check to see if the ezine sitename has been populated in the database already. If it has not then create a listing for it in table 1 and update table two with user info. If it has just update the traffic counter on table 1 (or you could just count the entries on table 2 instead), then update the table 2 with the latest visitor, along with the siteid where they came from. Then on the sales page after the sales etc, just update the converted from 0 to a 1. ie from false to a true 1.
    ---
    Easy as that.

    $_SERVER['HTTP_REFERER'] = website that sent you the traffic (this can be faked, but generally if the end user doesn't have a reason to fake it then they will not).

    if ($_SERVER['HTTP_X_FORWARD_FOR']) { $ip = $_SERVER['HTTP_X_FORWARD_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; }
    Will get you the IP of the visitor. That way you can traffic if they clicked more then once or came back. Can be faked to or return the IP of the proxy they are using.

    In addition to this you can add the time(); to track the date/time when they came to your website. Update the time when they converted to the sale. So you can maybe track how long it took them to buy your product.

    In addition you can set a tracking cookies and/or save php session id's to the data base when they are visiting your website.

    If you don't want to be bother by writing this application/script yourself; I work at a very cheap rate of $5 an hour and could make this all happen in 1 day as long as you have hosting.
    .
     
    exodus, Mar 6, 2009 IP
  5. mbaldwin

    mbaldwin Active Member

    Messages:
    215
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    95
    #5
    exodus,
    Thanks for that, This, i think i can manage, it was just a kick in the right direction I was looking for, but if you, or anyone for that matter wants to give me a quote on a job, I do not think I can do, then i have one for you.

    I will make a different post for it with the subject
    php programmer for website testing script

    Thanks,
     
    mbaldwin, Mar 7, 2009 IP