Question

They have: 38 posts

Joined: Dec 2002

I would like to be able to have a cookie that grabs a source from a URL and places it in a form so I can track where someone is coming from when they register. Is there a better way to do this? Is there a script out there to do this?

They have: 38 posts

Joined: Dec 2002

I guess a better what to put it is:

When i user comes to my site from a specific URL, say training.html?Source=google and they end up registering I would like to know that they came from source=google

How can I get that information if they directly do not register first?

Busy's picture

He has: 6,151 posts

Joined: May 2001

I think it's $_SERVER["HTTP_REFERER"]

They have: 461 posts

Joined: Jul 2003

i think busy is right, and want to warn you, some people have firewalls that remove that, and in all cases it's optional for the browser to send it. i belive mozilla firebird you can disable it as well as some others.

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

if it's a query string you can get that information by setting session variables that interpret it.

e.g.

if (isset($source) && $source == ('Google' || 'something in particular')) {
$_SESSION['source'] = $source;
}

You'd not want to be allowing people to set any source from a query string. Hopefully someone else can help with the security of this sort of thing.

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.