PDA

View Full Version : Tracking pages when javascript is disabled


webado
07-15-2005, 07:02 AM
Is it possible to add an extra parameter to the query string that is being passed to the image counter script in the <noscript>...</noscript> segment which would allow the page url to be passed?

I am thinking something like this:


http://c7.statcounter.com/counter.php?sc_project=999999&amp;java=0&amp;security=9999 9zzz&amp;invisible=1&amp;uri=http://www.mysiste.com/folder/page.html


When you generate the code you can generate it as usual with just the extra &amp;uri= at the end :

http://c7.statcounter.com/counter.php?sc_project=999999&amp;java=0&amp;security=9999 9zzz&amp;invisible=1&amp;uri=


and let the person provide their own page url to put in.

I realize however that's one more way for stats spam to be able to make it in there if anybody has both the project id and the security key.

07-15-2005, 07:04 AM
nice suggestion!!!

Yes this is a great idea.

Give me a S, give me a T give me a STICKY!

webado
07-15-2005, 07:49 AM
Actually I think you can do even better than this.

Add to that counter.php script this line:


$uri = $_SERVER['HTTP_REFERER'];


and I think you're in business, and no need for anybody to add things to the query string in the generated code.

At least this is what I get from my tests so far, not sure if there are circumstances where it might not work.

07-15-2005, 07:50 AM
nah won't work.

that's the referring url of the statcounter image called which will be blank.

webado
07-15-2005, 08:23 AM
nah won't work.

that's the referring url of the statcounter image called which will be blank.
Are you sure? I just made a test where I have this:

test.php:


<?php
$referer = $_SERVER['HTTP_REFERER'];

$alltext = "Page visited: " . $referer ;


$filename="test.txt";

if (!$handle = fopen($filename, 'wb')) {
echo "Cannot open file ($filename)"; // this won't show if in an image
exit;
}

// Write $alltext to our opened file.

if (fwrite($handle, $alltext) === FALSE) {
echo "Cannot write to file ($filename1)"; // this won't show if in an image

exit;
}

fclose($handle);

?>


And my html file where I use this script as an image:


<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

test.php

</body>
</html>


This results in the file test.txt (which is already created in my case) to contain the full url of the html page where the php images is used.

I tested it across 2 different domains as well.

Try this:
*** snip ***

and you'll see it actually works.

joepie91
06-03-2007, 09:46 AM
It *should* work (I'm a PHP programmer, and I tried such a thing before. Worked on PHPnet, but didn't on 1111mb), but some servers handle certain server variables different, it all depends on what server software they're using here.

webado
06-03-2007, 03:28 PM
Old thread. No longer pertinent.