Logging Referrers With Javascript

They have: 472 posts

Joined: Oct 1999

I found something called "document.referrer", I suppose it has something to do with referral webpages.

Can Javascript be used to log referrers?

------------------
Goodbookmarks.com - Quality Links To Quality Sites

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi,

document.referrer refers (I couldn't help it to the document which referred the current page. In other words if you came to this page from yahoo, the document.referrer would equal www.yahoo.com. It is sometimes used to determine if the user is coming from a page other than the main frameset, or the answer sheet from a quiz.
If by referral, you mean a click-through, I guess it could --
var lastSite = document.referrer;
for (i=0; i < referralArray.length; i++)
if (lastSite == referralArray[i])
givePoints(referralArray[i[;

Hope this answers your questions

final note: I've heard it is undependable

Vinny

------------------
my site:GrassBlade: cut&paste javascript
moderator at:The Javascript Place
Javascript City

[This message has been edited by Vincent Puglia (edited 11 June 2000).]

Where the world once stood
the blades of grass cut me still

They have: 231 posts

Joined: Feb 2000

You cant use client-side JavaScript alone to log the referrers. You need to use a server-side language (can use JScript with ASP) which has the ability to write to a text file or a database.

:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.