Welcome to Geeklog Saturday, October 20 2018 @ 07:32 pm EDT

Geeklog Forums

Any functions for stats and visitor counting


Status: offline

OMAL

Forum User
Chatty
Registered: 06/12/17
Posts: 59
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

Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/05
Posts: 1308
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.

Status: offline

OMAL

Forum User
Chatty
Registered: 06/12/17
Posts: 59
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.

Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/05
Posts: 1308
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.

Status: offline

OMAL

Forum User
Chatty
Registered: 06/12/17
Posts: 59
Thanks.

Status: offline

OMAL

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

Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/05
Posts: 1308
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.

PHP 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:

PHP 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.

Status: offline

OMAL

Forum User
Chatty
Registered: 06/12/17
Posts: 59
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?

Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/05
Posts: 1308
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

PHP 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.

Status: offline

OMAL

Forum User
Chatty
Registered: 06/12/17
Posts: 59
Thanks Laugh. I'll try it out.

All times are EDT. The time is now 07:32 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