Skip to content


WordPress -Counterize IIプラグインのカウンターをユニークにする

このエントリーをはてなブックマークに追加
はてなブックマーク - WordPress -Counterize IIプラグインのカウンターをユニークにする
Share on Facebook
Post to Google Buzz
Bookmark this on Yahoo Bookmark
Bookmark this on Livedoor Clip
Share on FriendFeed
Share on GREE

関連記事:WordPressのアクセス解析(カウンター)プラグインCounterize IIを導入CommentsAdd Star

カウンターを表示できるプラグインCounterize IIを先日入れたのだが、先日の手順ではユニークな数で表示してくれない。
つまり、1ユーザが2ページ遷移したらカウントが+2されてしまう訳だ。

なんか騙しカウンターみたいで嫌だなぁ~と思っていたので、暇な今、対処してしまおうと思う。

「昨日」のカウントを取るコードを書くことも出来るそうなのだが、自分のブログには不要なのでそれはカットする。

手順

  1. wp-content/plugins/counterizeii/browsniff.phpの末尾(?>の前)に以下のfunctionを追加

  2. function counterize_getuniquehitstotal()
    {
    $sql = 'SELECT count(DISTINCT ip,date(timestamp)) FROM ' . counterize_logTable();
    $wpdb =& $GLOBALS['wpdb'];
    return $wpdb->get_var($sql);
    }


  3. サイドバー(sideber.php)の適切な箇所に以下を追記。または変更。要はカウンターを表示させたい場所。

  4. <?php echo number_format(counterize_getuniquehitstoday()); ?> <!-- 今日のユニークなカウント -->
    <?php echo number_format(counterize_getuniquehitstotal()); ?> <!-- トータルのユニークなカウント -->
    <?php echo counterize_get_online_users(); ?> <!-- 現在の訪問者数 -->



    参考:Counterize II でWordPressにカウンタを表示する

    関連するかもしれない記事



    他のブログも読む

Posted in WordPress.

Tagged with , , , , .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. wordpressでカウンターのツボ linked to this post on 2010年3月19日

    [...] ITめもりーにょ [...]



Some HTML is OK

or, reply to this post via trackback.

*