owen

I can’t stop looking at my stats. I’ve made it too easy to get at them. Now, instead of blogging, I just sit here and push the “Show” button with the form set to “Top Referring Pages”.

Check out my top 10 search phrases:

    < ?php global $wpdb;

    $searches = $wpdb->get_results(“SELECT *, count(search_refer) AS Count FROM {$wpdb->searches}, {$wpdb->visitors}, {$wpdb->refer} WHERE search_refer = referer_id AND search_refer = referer AND referer_string<>’’ GROUP BY search_refer ORDER BY Count DESC LIMIT 10”);

    foreach($searches as $search)
    {
    echo “

  • {$search->Count} × {$search->search_phrase}
  • ”;
    }
    ?>

This list updates dynamically using PHP code in my post via EzStatic, fetching data from the BAStats tables. Sweet!