Recent Topics

1 Aug 27, 2004 23:27    

In the quest to get more useable information out from b2evo hitlog, here is an improvement to the b2stats.php.

It displays refered _articles_ in the blog. Here, my interest is more not on who is refering, but rather _what_ are they refering to.

Here's the code (all changes to admin/b2stats.php) :

1. to add new UI panel


<div class="pt">
        <div class="panelblocktabs">
                <ul class="tabs">
                <?php
                if( $show == 'summary' )
.....
                else
                        echo '<li>';
                echo '<a href="b2stats.php?show=other&amp;blog=', $blog, '">', T_('Direct Accesses'), '</a></li>';
vvv (see next 5 lines below) vvv
                if( $show == 'deluxe' )
                        echo '<li class="current">';
                else
                        echo '<li>';
                echo '<a href="b2stats.php?show=deluxe&amp;blog=', $blog, '">', T_('Stats Deluxe'), '</a></li>';
^^^ end of lines added ^^^
                ?>
                </ul>
        </div>
</div>

2. To display the statistics:

This code deleted from the post.
See next post ("Improved version") for the right code

2 Aug 27, 2004 23:34

There is more what I would like to get out of it:

1. to get also direct_accesses and direct_accesses+referers count.
(easily to accomplish, though refers are the more interesting)

2. to display a normal blog entry title (author, ...) instead of the url (visitURL). this is more difficult.

does anyone know a function in b2evo that returns pointer to blog Item, if it is given an URL?

or... can anyone help me make such function?

3. looking at other statistics there is plenty to wish for - i.e. summary statistics per RSS feeds (what RSS feeds are most used), all the same information limited by month or other time period, "Next page" link to get more hits, ...

It would also be nice to be able to see just most accessed (or refered) blog entries - counting them together even if refered from different webpages. This requires modification to _functions_hitlog.php to take out selecting refererURL.

More ideas could be out there - you name what you want to see.

3 Aug 27, 2004 23:56

so basicly i can cut/paste that code at the end of my b2stats.php and thats it?

(<-- newb to php code)

*edit*
oh right, basic code literacy .. never mind me.

4 Aug 28, 2004 00:12

Nope. Check out what he's showing. The .... is where code from the original file has been removed for convenient display. Then he shows some original code and a line "VVV --- (see next five lines below)--- VVV" that shows you what to add. Then he shows you the original code AFTER his additions.

Play with it though. Save your b2stats.php as b2stats_ORIGINAL.php then go ahead and find where he tucked in the parts he's added. Note that the VVV and ^^^ lines are there just to help people see what gets added - you don't actually put them in your code.

Probably gonna work like a charm too.

5 Aug 28, 2004 00:24

Improved version.

To simplify changes to b2stats.php, here is the improved version of the hack.

1. Save [url=http://captsolo.net/info/my-img/b2stat_deluxe.php.txt]this file[/url] with the name b2stat_deluxe.php in /admin directory.

2. Do the change from the original post with the name "1. to add new UI panel".

3. Do NOT do the change "2. To display the statistics: ", but instead of it add this (I have provided more context so you see where to add these lines. The actual code to add is just 5 lines, two of which are empty :) ):

                case 'useragents':
                        ?>
        <h2><?php echo T_('Top User Agents') ?>:</h2>
        <?php refererList(50,'global',0,0,"'no','invalid','badchar','blacklist','search'",'hit_user_agent',$blog,true,true);
  if( count( $res_stats ) )
  { ?>
        <table class="grouped" cellspacing="0">
                <?php
                        $count = 0;
                        foreach( $res_stats as $row_stats ) { ?>
                        <tr <?php if( $count%2 == 1 ) echo 'class="odd"'; ?>>
                                <td class="firstcol"><?php stats_user_agent( false ) ?></td>
                                <td class="right"><?php stats_hit_count() ?></td>
                                <td class="right"><?php stats_hit_percent() ?></td>
                        </tr>
                <?php
                $count++;
                } // End stat loop ?>
        </table>
  <?php
  }
                break;

vvv --- new code added below --- vvv
                case 'deluxe':

                require(dirname(__FILE__) . '/b2stat_deluxe.php');

                break;
^^^ --- end of new code --- ^^^

}
?>
</div>
<?php
require( dirname(__FILE__).'/_footer.php' );
?>

The new file b2stat_deluxe.php is quite "young".

It does what it promises (shows refered urls), it has some code for adding new kinds of statistics in new tabs, but you will have to hack it more to actually add those tabs. (i.e., move calling refererList(...) further down).

... also some safeguards should be created to avoid somebody calling this file directly ...

6 Aug 28, 2004 01:07

Updated the b2stat_deluxe.php file.

Now it has more sub-tabs and is easier to extend.
Currently existing tabs - "Referers", "Direct", "RSS", "other".

8 Aug 29, 2004 20:38

captsolo you oughta be promoted. Works like a charm! I am still having too many thoughts about my magpieRSS thing, but I feel like adding a tab to stat_deluxe for most frequent IP address. Why? Just because!

9 Sep 07, 2004 01:05

Why not? Add what you wish, just please publish here or send me your additions.

It could also be interesting to assign users unique IDs (via cookies; registered users already get a cookie :) ) and then see which user is in top stats. Or see what are user's browsing habits on your site.

This is similar to looking stats for IP address, but still not the same - i.e., many users may share the same IP address if they use a proxy.

10 Dec 20, 2004 18:11

I installed version 3, following your directions.

The following errors occur:

On Referrers Filtered tab:

Note: filtering only works if you have '.php' in your blog URLs.
If not, filtered view will return an empty list.

Notice: Uninitialized string offset: 4 in C:\Accounts\ellisweb\wwwRoot\aliyah\admin\b2stat_deluxe.php on line 141

On Direct Filtered

Note: filtering only works if you have '.php' in your blog URLs.
If not, filtered view will return an empty list.

Notice: Uninitialized string offset: 4 in C:\Accounts\ellisweb\wwwRoot\aliyah\admin\b2stat_deluxe.php on line 213

What should I do to fix this?

11 Jan 06, 2005 18:24

is it possible to seperate robot UAs from Browser UAs in the stats. It's difficult to pick out percentage IE vs Firefox vs Safari with all the robot entries.

I dont want to remove the robot entries as i use them to know when googlebot hit me ;) just seperate the two.

12 Jan 19, 2005 23:22

jellis613 wrote:

I installed version 3, following your directions.

The following errors occur:

On Referrers Filtered tab:

Note: filtering only works if you have '.php' in your blog URLs.
If not, filtered view will return an empty list.

Notice: Uninitialized string offset: 4 in C:\Accounts\ellisweb\wwwRoot\aliyah\admin\b2stat_deluxe.php on line 141

Let's check what it can be:

                <?php
                $count = 0;
                foreach( $res_stats as $row_stats ) {
                        $myURL = strstr( $row_stats['visitURL'], '.php' );
                        // $myPos = strstr( $myURL, '.php' ); echo $myPos . ' ' . $myPos{4} . '<p>';
                if ( $myURL{4} == '/' ) { ?>

Line 141 is the last line of the code above.
This part checks to see if there is a slash following the '.php' to see if it is a reference to a real post, or is it just the blog/category main page.

Aha - I see where the problem is.

You have "dirty" urls - notice how there are many parameters in the url following the .php:
http://www.ellisweb.net/aliyah/index.php?blog=3&title=what_do_american_jews_think_about_aliyah&more=1&c=1&tb=1&pb=1

This script was written for "clean" urls similar to this one:
http://captsolo.net/info/blog_a.php/2005/01/17/reflection_in_the_web
Notice there is a slash following .php

These better looking urls can be enabled in the blog configuration.

With old urls, the filtering will not work so well.
You may change "/" to "?" in the code in these 2 places.
This will probably filter out main pages, but not the category pages.

Maybe you or someone else can come up with an improved script, adapted also to the old URLs.

PS Those uninitialized offset notices are for the "root" pages where there are no characters following '.php'. I should fix this, but it is just a warning - problem of stats being empty (in your case) arises from the fact that the script cannot determine which are 'root' entries and which are posts. So it filters them all out.

13 Jan 19, 2005 23:39

demonraiser986 wrote:

is it possible to seperate robot UAs from Browser UAs in the stats. It's difficult to pick out percentage IE vs Firefox vs Safari with all the robot entries.

I dont want to remove the robot entries as i use them to know when googlebot hit me ;) just seperate the two.

Demonraiser,

If you are referring to Stats / UserAgents statistics, they are in there together.

What you can do is play a little bit with it yourself. This is why I created the "Stats Deluxe" in the first place.

Once you have the Stats Delux tabs, you can add whatever tabs you want there by just copying code for one existing tabs to a new place and do a couple of simple changes for adding this new tabs in the tab list. All that can be done by just editing b2stat_deluxe.php.

Take the code that is behind the User Agents tab, copy it over to stats deluxe and change it as you wish.

For the reference information you may want to look at /b2evocore/_functions_hitlogs.php file to see where the stats come from in the first place.

Nice blog (except for small red colored fonts maybe).
You may also want to use the "Recent Comments" hack to show the last comments directly on the first page.

14 Apr 08, 2005 04:07

Links to the hack file b2stat_deluxe.php were broken.
Fixed. enjoy B)

15 Apr 08, 2005 05:08

Hmmmm sorry but having this error and cant explain why? or fix it it would seem...

Anyone able to help?

Thanks

Fatal error: Call to undefined function: t_() in /home/virtual/site121/fst/var/www/html/b2blogs/admin/b2stat_deluxe.php on line 40

16 Apr 08, 2005 12:11

gacjezv wrote:

Fatal error: Call to undefined function: t_() in /home/virtual/site121/fst/var/www/html/b2blogs/admin/b2stat_deluxe.php on line 40

The file b2stat_deluxe.php is missing. Download it and place in the /admin directory of your blog.

See download link and instructions in [url=http://forums.b2evolution.net/viewtopic.php?p=10911#10911]this post[/url].
It is on this same thread, but the improved version and the link are located in the post I just gave link to, not the initial post of the thread. (Note to self: update the initial post)

17 Apr 11, 2005 07:26

Is this still sitting at version .3 or has other work been done?

18 Apr 13, 2005 03:10

Worked like a charm!

Thanks

19 Apr 13, 2005 14:09

Ioo, nice to hear it's good for you :)

Is this still sitting at version .3 or has other work been done?

This stuff is meant to be extended - by the users who make stats-deluxe tabs for what is needed - if it's not already there. I made some of the tabs, but can't think of all the things you may need. That's why the version is named .3 - it has a message - "extend it as you want".

There is an empty tab 'Other', standing there as a template for custom tabs. Just copy that empty tab, add the desired functionality, use it and share with others.

21 May 23, 2005 00:39

void  refererList( [  mixed  $howMany   = 5  ]  , [  mixed  $visitURL   = ''  ]  , [  mixed  $disp_blog   = 0  ]  , [  mixed  $disp_uri   = 0  ]  , [  mixed  $type   = "'no'"  ]  , [  mixed  $groupby   = ''  ]  , [  mixed  $blog_ID   = ''  ]  , [  mixed  $get_total_hits   = false  ]  , [  mixed  $get_user_agent   = false  ]  )

i can see obvious differences when i plug in values for $groupby from this list "'no','invalid','search'"

I cannot really tell what the differences are. I want to make sure i'm getting all BROWSER hits and only BROWSER hits. No bots, spiders, etc.


Form is loading...

CCMS – This forum is powered by b2evolution CMS, a complete engine for your website.