Retrieve Data from Piwik Database - Most Used Referer Keywords

Piwik is a wonderful system, thanks for all developers. I am developing web sites with admin panel to small scaled companies and for usage analysis I am normally given their username and pwd for Piwik application.

One of the clients asked for a very simple statistic screen so i am working on it (by hiddenly using Piwik anyway :))

But my question is:

how to create a simple table that shows MOST USED REFERER KEYWORD? How can i get this information from db. One is referer_keyword on prefix_log_visits, ok. Other one?

Thanks for help.

P.S. I see that Turskish translation page is not complete. I am working on it, once i will complete i will send it to forum.
P.S. If anyone interested, Below i am giving a basic table code that retrieves from Piwik DB.


 include("conn.php");
    	$sql="SELECT *, INET_NTOA(location_ip) AS location_ip FROM xx_log_visit AS location_ip ORDER BY idvisit DESC LIMIT 10";
    	$result=mysql_query($sql);
        $numofrows = @mysql_num_rows($result);
    
    	
    	while($row = mysql_fetch_array($result))
    	{
    		$id = $row['idvisit'];
            $saat = $row['visit_first_action_time'];
            $referer = $row['referer_name'];
                $gonderensite = substr($referer,0,15);
            $sayfasayisi = $row['visit_total_actions'];
            $ipgoster = $row['location_ip'];
    		$system = $row['config_os'];
                $SysName = array ("AND", "IPH", "LIN", "MAC", "UNK", "W2K", "W95", "W98", "WI7", "WME", "WNT", "WOS", "WS3", "WVI", "WXP");
                $SysRename = array ("<img src='images/os/AND.gif'>","<img src='images/os/IPH.gif'>","<img src='images/os/LIN.gif'>","<img src='images/os/MAC.gif'>","<img src='images/os/UNK.gif'>","<img src='images/os/W2K.gif'>","<img src='images/os/W95.gif'>","<img src='images/os/W98.gif'>","<img src='images/os/wi7.gif'>","<img src='images/os/WME.gif'>","<img src='images/os/WNT.gif'>","<img src='images/os/WOS.gif'>","<img src='images/os/WS3.gif'>","<img src='images/os/WVI.gif'>","<img src='images/os/WXP.gif'>");
                $sistem= str_replace($SysName, $SysRename, $system);
    		$browser = $row['config_browser_name'];
                $TarayiciIsimleri = array("IE", "FF", "OP", "CH", "SF"); 
                $TarayiciSimgeleri = array("<img src='images/browsers/IE.gif'>","<img src='images/browsers/FF.gif'>","<img src='images/browsers/OP.gif'>","<img src='images/browsers/CH.gif'>","<img src='images/browsers/SF.gif'>");
                $Tarayici= str_replace($TarayiciIsimleri, $TarayiciSimgeleri, $browser); 
            $ulke = $row['location_country'];

            echo ("
              <div class='sub01'>
                <div class='sub11'>$saat</div>
                <div class='sub12'>$ipgoster</a></div>
                <div class='sub13'><span title='$referer'>$gonderensite...</span></div>
                <div class='sub14'>$sayfasayisi</div>
                <div class='sub15'>$sistem</div>
                <div class='sub16' style='padding-top: 5px;'>$Tarayici</a></div>
                <div class='sub17' style='padding-top: 5px;'>$ulke</a></div>
              </div>
            " );        
	}

Happy to help you…

But my question still intact:

How can i create a similar table for MOST USED REFERER KEYWORD? How can i get this information from db.

Imagine there are two columns in the table:
Keywords and How Many Times.

Keywords will retrieve data from referer_keyword on prefix_log_visits.
but for how many times it is searched, which table and which row? It will be DESC order row as may guessed.

Thanks for any help.

Check out http://dev.piwik.org/trac/wiki/API

See our new page, which lists the various limits on historical data, number of websites, users, database size, when using Piwik: Data Limits Analytics