chrismarsden Posted August 31, 2010 Share Posted August 31, 2010 Hi, didnt know how to add this to the repository so can an admin move this please. this updated version will tell you still when you recieve a visitor but to identify who i have included so that it tracks the ip and tells you when its you!!! <?php // Script to email you when Google refers traffic to your site. $name=""; // add your name here $email_address=""; // add your email address here $keywords=""; $referrer=$_SERVER['HTTP_REFERER']; $known_ips = array( '01.01.01.01' => 'from the computer your are at now!', // etc. ); $ip = $_SERVER['REMOTE_ADDR']; if (array_key_exists($ip, $known_ips)) { $ip = $known_ips[$ip]; // you may want to use a different var name here now? } if( (stristr($referrer, "google")) && (stristr($referrer, "search")) ) { parse_str($referrer, $output); $keywords=$output['q']; $email_message="A visitor just arrived to the website after searching for '$keywords', Their IP address is '$ip'. ($referrer)"; mail ("$email_address","Google referred a visitor","$email_message"); } ?> hope it all works... give it a try and let me know. Quote Link to comment https://forums.phpfreaks.com/topic/212184-receive-and-email-when-google-refers-a-visitor-part-2/ Share on other sites More sharing options...
.josh Posted August 31, 2010 Share Posted August 31, 2010 We currently do not have a public code snippet feature / repo . Quote Link to comment https://forums.phpfreaks.com/topic/212184-receive-and-email-when-google-refers-a-visitor-part-2/#findComment-1105726 Share on other sites More sharing options...
chrismarsden Posted September 1, 2010 Author Share Posted September 1, 2010 Well its here any way for those that want it... lol Quote Link to comment https://forums.phpfreaks.com/topic/212184-receive-and-email-when-google-refers-a-visitor-part-2/#findComment-1105983 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.