How to keep track of clicks on my site?

Discussion in 'PHP' started by dreteh, Jun 14, 2010.

  1. #1
    Hello everyone,

    Let's say Site A has a link to Site B and if someone clicks on the link to Site B, Site B analytics will see a visit from Site A as referring site.

    But at the same time Site A wants to keep track of the clicks from Site A to Site B. If Site A uses a php redirection to keep track of the clicks, then Site B will not know the visitor is from Site A.

    How can I keep track of clicks for Site A and shows up on Site B as a referring site at the same time?

    Thank you very much.
     
    dreteh, Jun 14, 2010 IP
  2. Scripts man

    Scripts man Guest

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what about google analytics
     
    Scripts man, Jun 15, 2010 IP
  3. dreteh

    dreteh Member

    Messages:
    514
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    33
    #3
    Thanks for your reply but I have a database to keep track of these clicks.
     
    dreteh, Jun 15, 2010 IP
  4. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #4
    for A, you may have to encapsulate all links to a redirector script
    and B, you may want to use prepend file for tracking the referer or include in every page
     
    gapz101, Jun 15, 2010 IP
  5. ARTidas

    ARTidas Active Member

    Messages:
    177
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #5
    I would recommend you insert a php file in your index.php like:

    include_one(php/referer.php)
    Code (markup):
    And the referer.php would contain a

    $_SERVER['HTTP_REFERER'] <- this contain where the user comes from.
    $_SERVER['REQUEST_URI'] <- this contains the currently visiting site.

    And you only have to save these values into a DB...

    
    $from = $_SERVER['HTTP_REFERER'];
    $where = $_SERVER['REQUEST_URI'];
    
    mysql_query("INSERT INTO visitor SET from = '$from', where = '$where'");
    
    Code (markup):
    Don't forget to create the tables in your DB...

    Cheers,
     
    Last edited: Jun 15, 2010
    ARTidas, Jun 15, 2010 IP
  6. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #6
    Thats possible

    You can use an intermediate gateway script for that when sending to another url and the receiver side can able to use the HTTP Refferer function to count that
     
    roopajyothi, Jun 15, 2010 IP
  7. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    krsix, Jun 17, 2010 IP
  8. dreteh

    dreteh Member

    Messages:
    514
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    33
    #8
    Thanks everyone.
     
    dreteh, Jun 18, 2010 IP
  9. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #9
    Yeah!
    Just tried that Works so cool and great tool to use !
     
    roopajyothi, Jun 20, 2010 IP
  10. clox.c

    clox.c Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    i would pass all the links pointing out from site A to some sort of gateway script which tracks their target URL.
    use SERVER variables to check where visitors are coming from and save interesting results to a database (i.e. save visits coming from site B)
     
    clox.c, Jun 20, 2010 IP