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? 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. ?> 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? 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? 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 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
Archived
This topic is now archived and is closed to further replies.