stephaneeybert
asked on
Parsing the HTTP REFERER variable to detect the type of refering site
Hello!
I collect the visits to my web site, storing all HTTP REFERER variables into a database.
Now from this variable, I would like to detect if the referer is :
- a newsgroup
- Google
- another search engine than Google
- a direct access (url typed in, or a browser bookmark)
- a web site other than my web site and other than a search engine
- my web site
Any clue?
Regards
Stephane
I collect the visits to my web site, storing all HTTP REFERER variables into a database.
Now from this variable, I would like to detect if the referer is :
- a newsgroup
- another search engine than Google
- a direct access (url typed in, or a browser bookmark)
- a web site other than my web site and other than a search engine
- my web site
Any clue?
Regards
Stephane
ASKER
Hello,
Thanks for the comment. In fact I know that. My question is about how to parse it, what to look for, to get the informations I want...
Cheers
Stephane
Thanks for the comment. In fact I know that. My question is about how to parse it, what to look for, to get the informations I want...
Cheers
Stephane
ASKER
What logic to put in the parsing to get the details I need...
There are so many possible variations on Urls that parsing out specifics will almost require a regular experession for just about each instance tht you are looking for. What is it you are trying to parse out? Why you not just use the whole url?
Cd&
Cd&
ASKER
I'm doing a web site and I made a page to show the visitors and visits statistics.
The page shows which browsers are being used, which operating systems, how many visitors and visits per month... Now I would like to complete the work by adding in the page, where the visitors came from when visiting the web site. I would like to display how many came from:
- a newsgroup
- Google
- another search engine than Google
- a direct access (url typed in, or a browser bookmark)
- a web site other than my web site and other than a search engine
- my web site
And I'll display it with a graph (that part I know how to do).
The only thing that is hard for me to do, is how to parse the urls, with regular expressions, to retrieve the matches against the 6 options listed before.
Say, how to parse the url to check if it comes from a newsgroup, and if not, if it comes from Google...
Regards
Stephane
The page shows which browsers are being used, which operating systems, how many visitors and visits per month... Now I would like to complete the work by adding in the page, where the visitors came from when visiting the web site. I would like to display how many came from:
- a newsgroup
- another search engine than Google
- a direct access (url typed in, or a browser bookmark)
- a web site other than my web site and other than a search engine
- my web site
And I'll display it with a graph (that part I know how to do).
The only thing that is hard for me to do, is how to parse the urls, with regular expressions, to retrieve the matches against the 6 options listed before.
Say, how to parse the url to check if it comes from a newsgroup, and if not, if it comes from Google...
Regards
Stephane
ASKER
Doing a regular expression for each option that I am looking for is fine with me. Only, I'm no good with regular expressions...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah, I started doing a strstr() search for the Google case.
I'll do the same with the web site hostname for the internal hits.
Thanks anyway
Cheers
Steph
I'll do the same with the web site hostname for the internal hits.
Thanks anyway
Cheers
Steph
Glad I could help. Thanks for the A. :^)
Cd&
Cd&
The referrer is just a string containing the url where the link to your page was clicked. if the address was entered directly in the address bar or was click in favourites then teh referrer is empty; otherwise it is the url where the link was clicked. I don't believe there is an detail beyond that, so yuo would just have to paresr the url to get the site name.
Cd&