PHP Google Keyword Referrer


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // take the referer
  2. $thereferer = strtolower($_SERVER['HTTP_REFERER']);
  3. // see if it comes from google
  4. if (strpos($thereferer,"google")) {
  5. // delete all before q=
  6. $a = substr($thereferer, strpos($thereferer,"q="));
  7. // delete q=
  8. $a = substr($a,2);
  9. // delete all FROM the next & onwards
  10. if (strpos($a,"&")) {
  11. $a = substr($a, 0,strpos($a,"&"));
  12. }
  13. // we have the results.
  14. $mygooglekeyword = urldecode($a);
  15. }

URL: http://www.liamdelahunty.com/tips/php_google_referer.php

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.