Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How to check if a visitor came from a search engine?
Old 05-10-2011, 11:12 AM How to check if a visitor came from a search engine?
Super Talker

Posts: 113
Trades: 0
I would like to slightly change the content of a page if a user came from a search engine, as opposed to an email/blog/forum/etc link.

How should I go about doing this?

Thanks
Learnin' n00b is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-10-2011, 11:20 AM Re: How to check if a visitor came from a search engine?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Check the referrer ($_SERVER['HTTP_REFERER']) field for a known search engine.

But don't rely on it, as the field is optional and can be overridden by the client.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-17-2011, 04:58 AM Re: How to check if a visitor came from a search engine?
Experienced Talker

Posts: 48
Name: Websys_seo
Location: India
Trades: 0
if you are using Google analytics for tracking your statistics then you can follow this code:
Quote:
$refer=explode('utmcsr=',$_COOKIE['__utmz']);
if(count($refer)>1) $refer=explode('|',$refer[1]);
$refer=addslashes($refer[0]);
Here, when you will have a hit either from search engine or a direct hit, you will get the refer value. just check this.
__________________

Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Arings is offline
Reply With Quote
View Public Profile Visit Arings's homepage!
 
Old 05-18-2011, 09:27 PM Re: How to check if a visitor came from a search engine?
Super Spam Talker

Posts: 880
Name: Paul W
Trades: 0
Quote:
Originally Posted by Arings View Post
if you are using Google analytics for tracking your statistics then you can follow this code:


Here, when you will have a hit either from search engine or a direct hit, you will get the refer value. just check this.
And the data comes from 'HTTP_REFERER' originally so why add the extra step?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Old 05-20-2011, 08:15 AM Re: How to check if a visitor came from a search engine?
Banned

Posts: 122
Name: devashish kumar
Trades: 0
nice posting,I definitely use it.
devashishseo is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to check if a visitor came from a search engine?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16045 seconds with 12 queries