SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Track Who Is Using My Script

    Hi,

    I have a simple Javascript that bloggers use to load headlines from my site onto theirs. What is the best way to track which sites are using it?

    I've tried embedding a StatCounter tracker but it doesn't give me the page it's used on.

    Should I just identify the url that's requesting it, the IP address of the user, and plug it into a database? Any general advice on how to proceed would be greatly appreciated.

    David

  2. #2
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One more thing...

    I'm using an HTML image-based tracking code rather than the actual StatCounter javascript. I couldn't figure out how to embed a javascript tracker inside of javascript. Would using that achieve what I want and does anyone have any idea how I can embed the javascript?

    Currently, my script simply outputs a series of document.write('') statements.

  3. #3
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Use the page refer header, but even that isn't fool proof could probably do....
    HTML Code:
    <img src="http://yoursite.com/clearimage.php?fromsite=http://sitesurl.com" width="1" height="1" alt="">
    then that php page:
    PHP Code:
    <?php

    $site 
    $_GET['fromsite'];
    // Do validation stuff then enter into the database.
    // Next do a little simpile image creation stiff or load
    // the contents of an exsiting image below.

    header('content-type: image/gif');
    // blah...
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  4. #4
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome. Thanks for such a fast response. This is close to what I'm looking for. Unfortunately, I won't have a fromsite type variable to work from. Everyone is using the same code for the script. Is there a way to determine from the php file what page or at least which domain it's being called from?

  5. #5
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $site $_SERVER['HTTP_REFERER']; 
    How ever the HTTP Referer can't be trusted because the web client can chose to not send or send a made up HTTP Referer header.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •