mga_ka_php Posted December 28, 2008 Share Posted December 28, 2008 how do i track the search phrases used by users in search engine to go to my website? Quote Link to comment https://forums.phpfreaks.com/topic/138621-how-to-track-search-phrases/ Share on other sites More sharing options...
flyhoney Posted December 28, 2008 Share Posted December 28, 2008 Do you have a mysql database? If you do, create a search_phrases table in your database. Whenever anyone searches, add an entry for their search phrase. Along with the search phrase, have a count column. If someone searches for a phrase that already exists in the database, increment the count column. <?php $query = $_GET['query']; $query = "SELECT COUNT(*) as total FROM search_phrases WHERE phrase = '". mysql_real_escape_string($query) ."'"; // Im honestly too drunk to finish this code, but if the search phrase exists, increment the count, if it doesnt, insert it into the database. ?> Quote Link to comment https://forums.phpfreaks.com/topic/138621-how-to-track-search-phrases/#findComment-724793 Share on other sites More sharing options...
mga_ka_php Posted December 28, 2008 Author Share Posted December 28, 2008 how do $_GET['query'] will have value? i add echo $_GET['query'] into my index.php then go to google then entered the search phrases then click my site and it doesn't have a value how do i get that search phrase? Quote Link to comment https://forums.phpfreaks.com/topic/138621-how-to-track-search-phrases/#findComment-724812 Share on other sites More sharing options...
mga_ka_php Posted December 30, 2008 Author Share Posted December 30, 2008 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/138621-how-to-track-search-phrases/#findComment-725824 Share on other sites More sharing options...
RussellReal Posted December 30, 2008 Share Posted December 30, 2008 $_SERVER['HTTP_REFERER']; parse the search phrase from the referer Quote Link to comment https://forums.phpfreaks.com/topic/138621-how-to-track-search-phrases/#findComment-725826 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.