Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 02:33 pm EDT

Geeklog Forums

Any functions for stats and visitor counting


Status: offline

OMAL

Forum User
Regular Poster
Registered: 12/06/17
Posts: 107
Are there any functions for stats or visitor counting in geeklog?
If any, I'll customize it for my site.
Like this
https://demos3.softaculous.com/Geeklog/stats.php

Where can I get this stats.php src file?

Thanks
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
You could either download Geeklog to get the file or look at it on GitHub:

https://github.com/Geeklog-Core/geeklog/blob/master/public_html/stats.php

You could also install the GUS Plugin (stands for Geeklog Usuage Statistics)

GUS Plugin v1.7.4

It will track any visitors to your website.


One of the Geeklog Core Developers.
 Quote

Status: offline

OMAL

Forum User
Regular Poster
Registered: 12/06/17
Posts: 107
Thanks for the information, Laugh.
Now I found out GL has functions to handle hits and clicks, but do you know the way how to reset stats every month? I want to provide monthly stats.
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
Yes Stats.php runs off an api that the plugins used. There is no way to rest these and no way to define it by month.

If you want to just count number of visitors per month,week, day, etc.. the GUS Plugin will do that for you.
One of the Geeklog Core Developers.
 Quote

Status: offline

OMAL

Forum User
Regular Poster
Registered: 12/06/17
Posts: 107
Thanks.
 Quote

Status: offline

OMAL

Forum User
Regular Poster
Registered: 12/06/17
Posts: 107
How can I customize codes to prevent hits of Table "story" from adding by google bots and administrators?
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
Look in the public_html_article.php file around line 330. You can see we already make sure that the author of the story doesn't add to the hits of a article.

Text Formatted Code
       
// Don't count views for the author of the article (feature request #0001572)
if (COM_isAnonUser() || ($_USER['uid'] != $article->displayElements('uid'))) {
    DB_query("UPDATE {$_TABLES['stories']} SET hits = hits + 1 WHERE (sid = '" . DB_escapeString($article->getSid()) . "') AND (date <= NOW()) AND (draft_flag = 0)");
}


You can add into the if statement:

Text Formatted Code
|| !SEC_inGroup('Root', $_USER['uid'])


to not include the admin.

For Google bots it is a little more difficult as those are constantly changing and being spoofed. You would need to look at the referrer and go from there.
One of the Geeklog Core Developers.
 Quote

Status: offline

OMAL

Forum User
Regular Poster
Registered: 12/06/17
Posts: 107
THanks Laugh.

Work almost done, but I still seems to have few issues that need some advice.
The programs I'm working with count the actual posts. When a user publish post in the future, it fails.
So I have to add counter when the future publication occurs.

What are the php file names for future publication task in geeklog?
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
Future articles are available online as soon as the date and time passes. No code is used to do this as it is just based on the date stored in the database.

We do have to do some checks to see if we need to update articles feeds in lib-common.php

Look at around line 554 for the comment

Text Formatted Code
// Figure out if we need to update article feeds. Check last article date published in feed


to see the code that does the check. You could probably add your code here.
One of the Geeklog Core Developers.
 Quote

Status: offline

OMAL

Forum User
Regular Poster
Registered: 12/06/17
Posts: 107
Thanks Laugh. I'll try it out.
 Quote

All times are EDT. The time is now 02:33 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content