bstat Search Cloud

Casey over at MaisonBisson has developed a sweet WordPress plugin called bstat. I’ve been using it since I installed WordPress as my blog. Well, one thing that is missing from the plugin that I decided I wanted was a search cloud (like a tag cloud, only for incoming searches)… I recently created a tag cloud on MasterWish so decided to use that. Here’s the function.

Special Functions

  • bstat_search_cloud

Usage:

bstat_search_cloud(post_id, maxresults, days, starting_font_size);

  • post_id is the post_id for the story, usually provided by a WP variable. A value of 0 is used for grabbing all search terms from any post
  • maxresults is the number of search terms you wish to retrieve
  • days is the number of days back to look
  • starting_font_size is the starting font size of the smallest search term

Example:


<h3>All incoming search terms for this post</h3>
<small>< ?php bstat_search_cloud(0,50); ?></small>

Discuss This Article


20 Responses to “bstat Search Cloud”

  1. AvatarCasey

    Good stuff. I’m marking it for inclusion in the next release.

    Reply to this comment.
    1
  2. AvatarJamie

    Hi

    This is just what I am looking for, but how do I add it to my blog.

    Some help would be great.

    Jamie

    Reply to this comment.
    2
  3. AvatarMatt
    Author Comment

    @Jamie

    You need to have bsuite installed first. Once that is installed and running, simply refer to the example in this blog post.

    Reply to this comment.
    3
  4. AvatarJack

    is it add

    ‘;

    $request=”select num from (select * from (select distinct(ref) ref,count(ref) num from wp_bstat_refs WHERE ref not like ‘http%’ and ref not like ‘www%’ AND bstat_date > ‘$date’ $post_id group by ref) t1 order by num desc limit 0,$maxresults) t2 order by num asc limit 0,1″;
    if($row=$wpdb->get_results($request))
    {
    $divisor=ceil($row[0]->num/$starting_font_size);

    $request = “select * from (select * from (select distinct(ref) ref,count(ref) num from wp_bstat_refs WHERE ref not like ‘http%’ and ref not like ‘www%’ AND bstat_date > ‘$date’ $post_id group by ref) t1 order by num desc limit 0,$maxresults) t2 order by ref”;
    $rows = $wpdb->get_results($request);
    foreach($rows as $row)
    {
    $tag=array(
    ‘ref’=>$row->ref,
    ‘num’=>$row->num
    );

    $rows2 = $wpdb->get_results(”SELECT * FROM wp_bstat_refs WHERE ref=’”.$tag['ref'].”‘”);
    $tag['link']=get_permalink($rows2[0]->post_id);
    $tag['size']=10;
    $tag['size']+=(floor(($tag['num']/$divisor)/$starting_font_size)*2);
    $tag['size']=($tag['size']>30)?30:$tag['size'];
    $tag['ref']=str_replace($search,$replace,$tag['ref']);
    $text.=’‘.$tag['ref'].’  ‘.”\n”;
    }//end foreach
    $text.=”;
    echo $text;
    }//end if
    }//end bstat_search_cloud
    ?>

    to bsuite code?

    Reply to this comment.
    4
  5. AvatarJack

    i have the error after that..

    Reply to this comment.
    5
  6. Avatarrobinson

    I’ve been looking for bstat but I can’t find a valid url. including the one at MaisonBisson… is there any one who knows the valid url for downloading the bstat? if there’s a tutorial it would be very help full…. thanks..

    Reply to this comment.
    6
  7. AvatarMatt
    Author Comment

    Bstat has gone through a name change a while back and is now known as Bsuite. You can find it here

    Reply to this comment.
    7
  8. AvatarBudi S

    Can you gi give me bstat.zip ….
    because i have download but it can’t be opened …
    thx

    Reply to this comment.
    8
  9. Avatarpeter

    hi Matt, I have install latest bsuite and activate it. but I do not know how and where to add “bstat_search_cloud” and “All incoming search terms for this post
    ” . can you give me detail steps, thank very much

    Reply to this comment.
    9
  10. AvatarGadgetHeat

    Hi Matt

    I am trying to adjust your code for bsuit4 so that I can show the incoming search cloud in my posts but am having no luck. I have adjusted you syntax as below but I get the following error

    ‘WordPress database error: [Unknown column 'post_id' in 'where clause']
    select num from (select * from (select distinct(name) name,count(name) num from wp_bsuite4_hits_terms WHERE name not like ‘http%’ and name not like ‘www%’ AND post_id=1654 group by name) t1 order by num desc limit 0,50) t2 order by num asc limit 0,1′

    Can you please tell me where I am going wrong and prefferably how to fix it? My code is below:

    <?php
    function bstat_search_cloud($post_id, $maxresults, $days=365, $starting_font_size=9)
    {
    global $wpdb, $bsuit4_hits_table;
    $search=array(’tag/’,'tags/’);
    $replace=array(”,”);

    $date = date(”Y-m-d”, mktime(0, 0, 0, date(”m”) , date(”d”) - $days, date(”Y”)));
    $post_id=($post_id)?” AND post_id=$post_id”:”;

    $text=”;

    $request=”select num from (select * from (select distinct(name) name,count(name) num from wp_bsuite4_hits_terms WHERE name not like ‘http%’ and name not like ‘www%’ $post_id group by name) t1 order by num desc limit 0,$maxresults) t2 order by num asc limit 0,1″;
    if($row=$wpdb->get_results($request))
    {
    $divisor=ceil($row[0]->num/$starting_font_size);

    $request = “select * from (select * from (select distinct(name) name,count(name) num from wp_bsuite4_hits_terms WHERE name not like ‘http%’ and name not like ‘www%’ $post_id group by name) t1 order by num desc limit 0,$maxresults) t2 order by name”;
    $rows = $wpdb->get_results($request);
    foreach($rows as $row)
    {
    $tag=array(
    ‘name’=>$row-> name,
    ‘num’=>$row->num
    );

    $rows2 = $wpdb->get_results(”SELECT * FROM wp_bsuite4_hits_terms WHERE name =’”.$tag['name'].”‘”);
    $tag['link']=get_permalink($rows2[0]->post_id);
    $tag['size']=10;
    $tag['size']+=(floor(($tag['num']/$divisor)/$starting_font_size)*2);
    $tag['size']=($tag['size']>30)?30:$tag['size'];
    $tag['name']=str_replace($search,$replace,$tag['name']);
    $text.=’‘.$tag['name'].’  ‘.”\n”;
    }//end foreach
    $text.=”;
    echo $text;
    }//end if
    }//end bstat_search_cloud
    ?>

    Thanks
    Saif

    Reply to this comment.
    10
  11. AvatarGadgetHeat

    Finnaly got this working (Yay me!) If anybody wants to know contact me via my website

    Reply to this comment.
    11
  12. AvatarGadgetHeat

    Finnaly got this working (Yay me!) If anybody wants to know contact me via my website

    Finnaly got this working (Yay me!) If anybody wants to know contact me via my website

    Finnaly got this working (Yay me!) If anybody wants to know contact me via my website

    Finnaly got this working (Yay me!) If anybody wants to know contact me via my website

    Hello,

    it didn’t worked for you , you are still gettings errors.

    -DS

    Finnaly got this working (Yay me!) If anybody wants to know contact me via my website

    Finnaly got this working (Yay me!) If anybody wants to know contact me via my website

    Finnaly got this working (Yay me!) If anybody wants to know contact me via my website

    Reply to this comment.
    12
  13. AvatarGadgetHeat

    It is working fine. Look at the bottom of my individual posts. You will see incoming search terms linked to the post title.

    The only problem I have left is excluding search terms which have key characters such as ‘\’. I need to escape these then everything will be perfect.

    Reply to this comment.
    13
  14. AvatarDS

    Nice job GadgetHeat , awesome !

    It’s working fine …i was looking for posts where there wasnt’ any incoming searches…my bad.

    Anway can you help me with this..i am struggling for this for last 2 weeks and haven’t done any progress. I have got bsuite plugin activated, and created a seprate function, then added that function into functions.php..but it doesn’t work .
    Thanks !

    Reply to this comment.
    14
  15. AvatarUrban

    Nice job GadgetHeat , awesome !
    It’s working fine …i was looking for posts where there wasnt’ any incoming searches…my bad.
    Anway can you help me with this..i am struggling for this for last 2 weeks and haven’t done any progress. I have got bsuite plugin activated, and created a seprate function, then added that function into functions.php..but it doesn’t work .
    Thanks !

    Hi,

    I was trying to contact you through your form on the website, but the page didn’t work, some php error… so I contacted an email address that I found on your website. Don’t know if it works.

    Anyhow, can you help me with the solution? I’m stuck.

    And did you solve the character issues? I for example have lots of articles containing the “-” character. Is this a problem? Or do I understand this wrong? Where is that character issue coming up?

    Reply to this comment.
    15
  16. AvatarBinh Nguyen

    Thank you for this special function. I’m looking for something to do search cloud like yours.

    But there is a problem. Does this still work for the current bSuite plugin? If not… do you have any fix?

    Thanks.

    Reply to this comment.
    16
  17. AvatarGautam

    @GadgetHeat: care to share what needs to be done.

    Anyone else got it to work ?

    Any lead would be of great help.

    /G

    Reply to this comment.
    17
  18. pingback pingback:
      Top incoming search terms for this post - incoming search term tagging by Gautam H N

    [...] You can find Matts version here : http://borkweb.com/story/bstat-search-cloud [...]

    Reply to this comment.
    18
  19. AvatarIncoming Search Term Tagging

    I finally got “Top incoming search terms for this post” to work:

    Folks who still are looking for it, can look at it at :

    http://www.techbuzz.in/top-incoming-search-terms-for-this-post-incoming-search-term-tagging.php

    Reply to this comment.
    19
  20. AvatarClara Lopez

    xogc9iqasrwgxe4v

    Reply to this comment.
    20

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comment Preview:

 (1113) - search cloud (92) - bstat (27) - search (13) - WordPress search cloud (12) - Bstat plugin (11) - list incoming searh terms in wordpress (8) - bstat search cloud (7) - bstat cloud (5) - bstat.zip (5) - INCOMING SEARCH TERMS wordpress (5) - incoming searches in wordpress (4) - php search cloud (3) - tag to show incoming search terms wordpress (3) - bstat.php (3) - wordpress incoming search terms (3) - bsuite (3) - how to use incoming searches into wordpress using bstat (3) - search cloud wordpress (3) - tag cloud (2) - incoming search term tagging (2) - bstat incoming search cloud (2) - incoming search terms plugin (2) - search terms (2) - incoming search link using bstat in wordpress (2) - searchcloud wordpress (2) - incoming Search wordpress plugin (2) - BSTAT download (2) - bstat wordpress plugin (2) - wp search term taging (2) - wordpress search with cloud (1) - wp search cloud (1) - search cloud wp (1) - wordpress incoming search term tagging (1) - wp plugin for Incoming search terms: (1) - bsuite plugin tag cloud (1) - $wpdb->get_results (1) - wp_bsuite4_hits_terms post (1) - Top incoming search terms for this post bsuite (1) - what is search cloud zip? (1) - searchcloud.zip (1) - searchTermTagging wordpress (1) - cloud search tutorial (1) - Incoming Search Terms for the Article plugin (1) - text cloud from search term (1) - searches cloud wordpress (1) - Incoming Search Terms for post wordpress (1) - wordpress get_results terms tags (1) - bsuite don't search pages (1) - bstat wordpress free download (1) - how to get bsuite 4 incoming search taging to work (1) - cloud search function (1) - bsuite 4 incoming search tagging problem (1) - bstats search term tagging (1) - search bstat (1) - borkweb bstat plugins (1) - bstat, plugin, wordpress (1) - download bstat (1) - incoming search term wp plugins (1) - bstat php (1) - php search cloud example (1) - bsuite search cloud (1) - download bstat plugin (1) - bstat_search_cloud (1) - Incoming Search Terms plugin wordpress (1) - Incoming search terms wp plugin (1) - wordpress plugin search cloud (1) - search term cloud (1) - DESC LIMIT 0,$maxresults (1) - search cloud wo wp (1) - example tags search cloud (1) - bsuite bstat tutorial (1) - incoming tag in wordpress (1) - Incoming Search Term wordpress (1) - incoming search terms plugin bstat (1) - wordpress incoming search term plugin (1) - wordpress Incoming Search Terms for the post plugin (1) - download bstat.zip wordpress (1) - wordpress search term cloud (1) - article incoming search terms plugins (1) - tutorial search cloud (1) - search terms cloud (1) - caseybisson (1) -