last updated:

UPDATE: I forgot to tell people that there are two small edits that have to be made to the attached script in order to make it site-specific; see #4 in the installation instructions below.

After running well for over a week, and working out a few bugs, I think that the code for the Referrer Log is ready for release. It’s attached to this message; if you have any problems, questions, or anything like that, just respond to this message. (If you don’t see the header above that shows the attachments, then you’re probably in story view mode; switch to discussion group mode and you’ll see it.)

What does it do?

It shows you a table of all of the websites that are listed as referrers in hits to your website. (This information is kept in the mainResponder logs, and has heretofore been hard to get at in a quick way.)

What does it look like?

You can see an example on this website. It’s been running here since January 3rd.

How do I use it?

You’ve got to have your own Frontier server; the Referrer Log runs as a safe macro, so you have to have the ability to add a script into the #tools table of your website, and have to be able to modify the list of safe macros. Here’s how you do everything:

  1. First, download the getReferrers script from this message. (It’s linked above, in the message header; the easiest way is to click on the fat page link and save the resulting web page to your hard disk.)
  2. Import the script into Frontier. (If you saved the fat page, just use Frontier’s File/Open menu command to open the page.) Save the script into the #tools table of your Manila website, with the name getReferrers. (On my machine, that’s quesoManilaWebsite.[“#tools”].getReferrers.)
  3. Tell Frontier that the script is safe to run as a macro. You do this at config.mainResponder.prefs.legalMacros; inside this table, create another table named getReferrers. Within this new table, create two entries, both booleans — flLegal (set to true), and flParams (also set to true). (If you wanna read it, the straight dope on safe macros from Userland is here.)
  4. Edit the script to refer to your own website, rather than to mine. :) There are two places in the script to change:
    • The line that reads if mrLog^[i][j].host == “q.queso.com” should have your own website hostname in it — this is the line that returns just those hits that are for your website. (It’s meant to help with machines, like EditThisPage, that serve up more than one Manila site — you’ll be able to limit the referrers to just one site.)
    • The line that reads if string.patternMatch(“queso.com”, nameOf(referrerTable[i])) > 0 should also be changed to the domain name of your site — it will eliminate all of the references from your own domain. (This will eliminate pages on other webservers of yours that point to your Manila site — it was something that I wanted for my own.)
  5. Lastly, you have to be using guest database logging — it’s the guest database that the script trawls through in order to get all of the referrers. In order to make sure that you’re logging to a guest database, go to user.log.prefs.flLogToGuestDatabase and set it to true.

That’s it for installation — the script now exists in your Manila website, and set up as a safe macro.

Now, as for using the macro… that’s easy. You can just put {getReferrers()} in any discussion group message or story, and it will be replaced by a table of your referrers, just like the table on q.

Also, remember that you can use your Advanced Prefs of your Manila site to create a site structure link to your referrers page (so you can end up with URLs like http://q.queso.com/referrers).

What if I find a problem?

Please mail me with anything that you find, including security issues (since this is a safe macro, and I should make sure that it stays safe).

Comments

Jason,
I downloaded this successfully via RPC and I have it running on MedEd News. I did change a couple of references to “queso.com” in the code to the name of my own server. Thanks!

• Posted by: David Theige on Jan 12, 2000, 3:44 PM

Yep, I totally forgot to put that in the readme. Ugh. It’s there now.

I just looked for it on MedEd News, and didn’t find any reference… is it something that the public can look at?

Glad that it’s working!

/jason

• Posted by: Jason Levine on Jan 12, 2000, 7:54 PM

—->ignore

sorry.

• Posted by: Erin Clerico on Jan 15, 2000, 3:23 AM

Thanks dude.

See it at:

http://villageNews.weblogger.com/discuss/msgReader$291

or

http://www.fragdifferent.com/discuss/msgReader$291


(the fact that both messageNum values are the same is a really strange coincident! It must be a sign from the gods!)

-Erin Clerico

• Posted by: Erin Clerico on Jan 15, 2000, 3:24 AM

Great Tool, Jason! This helps me keep track of which places are working for me as far as search engines etc. I run www.blogthis.com which is registered with most of the search engines, and weblog monitoring sites. Your tool is very helpful.

• Posted by: Scott on Jan 16, 2000, 4:57 PM

nice one, thanks.

i downloaded the script and added some tweaks:


  • you can put it in your users.html.macros table to run on every website hosted by the server.
  • you can get the URL of your site out of the pagetable

contact me, if you need details.

kris

• Posted by: arf on May 2, 2000, 6:47 PM

I hadn’t thought of getting the URL out of the pagetable — dumb me, since most of my other utility scripts do exactly that!

As for the ability to put it into your user.html.macros table, did you have to add anything to the script to allow that? It seems that you should just be able to do that out of the box.

/jason

• Posted by: Jason Levine on May 2, 2000, 10:25 PM

As for the ability to put it into your user.html.macros table, did you have to add anything to the script to allow that? It seems that you should just be able to do that out of the box.

the macros in user.html.macros work on all websites — static and dynamic. you put your macro there instead. if you have an additional macro in your #tools table it will be taken instead of the one in
user.html.macros.

i also modified it to work for websites with a name like http://[xxx.xxx.xxx]/[identifier]/. It is fairly simple as well.

another thing: live could be easier if you use the commands
***beginsWith
and
***contains
if you work with strings.

kris

• Posted by: arf on May 3, 2000, 6:22 AM
Please note that comments automatically close after 60 days; the comment spammers love to use the older, rarely-viewed pages to work their magic. If comments are closed and you want to let me know something, feel free to use the contact page!