Forum Moderators: open
At both A & B, I've put in a CSS reference to a php file on another site I control (we'll call it site C), using the Link Rel=stylesheet, then an HREF to the php script on site C, though instead of a CSS file it's a php file. The php runs on site C and records time of visit, IP address, etc., but for the referrer it (of course) records the site that called the script (either A or B). While I'd like to keep that info, I'd also like to record the referrer that led the surfer to site A or B. In other words, I want to pass the data from the original site, A or B, to site C for logging.
Basically, I'm looking for something like the functions you get with sitemeter.com, but don't want to use something like sitemeter. Since sitemeter and others do this sort of thing I know it's doable, but I've not figured out how to accomplish the task and after off and on trying various ways and off and on searching for ways, I'm still not figuring it out or finding it. Any suggestions?
Thanks,
Rick
Would it be alright to just pass the original referrer as an argument in the querystring?
It'd be alright with me, but mechanically how do I go about that. Also, keep in mind I'm limited in what I can do at the blog site.
One note I should have added: I'm by no means a guru -- nor even accomplished -- with php nor java; I don't program in them as a hobby nor as my livelihood. I only dig into them a bit when I want to accomplish something, so have played around with both. I do have some programming in my background, but it's older knowledge (as befits an older person - smile).
Thanks,
Rick
Rick
<script type="text/javascript">
document.write('<link rel="stylesheet" src="http://www.example.com/main.css?referrer=' + document.referrer + '">');
</script>
<noscript>
<link rel="stylesheet" src="http://www.example.com/main.css">
</noscript>
PHP Solution:
<link rel="stylesheet" src="http://www.example.com/main.css?referer=<?=$_SERVER["HTTP_REFERER"]?>">
i.e., changed the .css to .php (wasn't sure how I'd trigger the php file to run by using the .css extension).
That didn't work; for whatever reason, neither site would access the script (at least, from the script side of things it no longer "triggered"). So then changed it to mimic the original call I was using:
link rel="stylesheet" type="text/css" href=
instead of
link rel="stylesheet" src=
and that now works. I get what I'm looking for with the PHP REQUEST_URI variable, and it also shows up in the PHP REMOTE_QUERY variable.
Thanks, guys.
Rick