Posted on: 05/11/18 12:44pm
By: OMAL
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
Re: Any functions for stats and visitor counting
Posted on: 05/11/18 03:22pm
By: Laugh
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.
Re: Any functions for stats and visitor counting
Posted on: 05/12/18 03:08am
By: OMAL
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.
Re: Any functions for stats and visitor counting
Posted on: 05/12/18 10:06am
By: Laugh
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.
Re: Any functions for stats and visitor counting
Posted on: 05/16/18 08:36am
By: OMAL
Thanks.
Re: Any functions for stats and visitor counting
Posted on: 05/28/18 09:49pm
By: OMAL
How can I customize codes to prevent hits of Table "story" from adding by google bots and administrators?
Re: Any functions for stats and visitor counting
Posted on: 05/29/18 07:01am
By: Laugh
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.
Re: Any functions for stats and visitor counting
Posted on: 06/11/18 09:05am
By: OMAL
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?
Re: Any functions for stats and visitor counting
Posted on: 06/11/18 09:18am
By: Laugh
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.
Re: Any functions for stats and visitor counting
Posted on: 06/11/18 10:05am
By: OMAL
Thanks Laugh. I'll try it out.