Statistics in OJS 3.1.1.2


#1

I manage two websites under OJS 3.1.1.2, new installations, but in both statistic report doesn`t work. I wait a few days but still nothing. I read the post, implement some code but nothing.
When I click View Report in Statistic in error log received:

[30-Jun-2018 13:12:32 UTC] PHP Strict Standards: Declaration of AddThisPlugin::register() should be compatible with LazyLoadPlugin::register($category, $path, $mainContextId = NULL) in /home/fj0i1nulvabk/public_html/plugins/generic/addThis/AddThisPlugin.inc.php on line 175
[30-Jun-2018 13:12:32 UTC] PHP Strict Standards: Declaration of OpenAIREDAO::setOAI() should be compatible with PKPOAIDAO::setOAI($oai) in /home/fj0i1nulvabk/public_html/plugins/generic/openAIRE/OpenAIREDAO.inc.php on line 19
[30-Jun-2018 13:12:32 UTC] PHP Strict Standards: Declaration of CustomBlockPlugin::getBlockContext() should be compatible with BlockPlugin::getBlockContext($contextId = NULL) in /home/fj0i1nulvabk/public_html/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 134
[30-Jun-2018 13:12:32 UTC] PHP Strict Standards: Declaration of CustomBlockPlugin::getEnabled() should be compatible with BlockPlugin::getEnabled($contextId = NULL) in /home/fj0i1nulvabk/public_html/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 134
[30-Jun-2018 13:12:32 UTC] PHP Strict Standards: Declaration of DRIVERDAO::setOAI() should be compatible with PKPOAIDAO::setOAI($oai) in /home/fj0i1nulvabk/public_html/plugins/generic/driver/DRIVERDAO.inc.php on line 65

The same results are with other reports. Also, after implement code for abstract and download I received only zero - 0. On other OJS, earlier version, that code works but here no.
How to solve this problem, to have statistic view in OJS 3.1.1.2?


#2

Hi @Lazar_Stosic

To double check:
Your Usage Statistics plugin is enabled?
Your Usage event plugin is enabled?
Are you using Acron plugin or did you define a cron job?
Are there any log files in any of the subfolder in your folder usageStats/ in your files folder?
Are your permissions in the files folder correct?
Do you see the UsageStatisicLoader class in your DB table scheduled task?
Do you have any data in your DB table metrics?

Those PHP messages are not important – they are not the real errors – you could even configure your PHP logging not to include them.

What exactly do you mean with “implement some code”?

When you try to create a report, do you get any file for download?

Best,
Bozana


#3

Hi @bozana,

Your Usage Statistics plugin is enabled?
Your Usage event plugin is enabled?

The answers are YES.

Are you using Acron plugin or did you define a cron job?
I am using Acron plugin.

Are there any log files in any of the subfolder in your folder usageStats/ in your files folder?
In folder usageStats/, in subfolder usageEventLogs I have log file with the today date where are a lot of data like:
66.249.75.10 bot - “2018-07-05 22:13:34” http://xx.xx.uxxxxnibl.xxx/index.php/AE/article/download/35/29/57 200 “Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Safari/537.36”

Are your permissions in the files folder correct?
Permissions are 750.

Do you see the UsageStatisicLoader class in your DB table scheduled task?
Do you have any data in your DB table metrics?
I don`t have permission on that at the moment. System administrator has that privileges. If I need, I can ask them.

What exactly do you mean with “implement some code”?
I implement/insert the codes which I found on the similar post for statistic and also the codes which I have on earlier version of OJS where everything works. But, in two new OJS 3.1.1.2, with different system provider I have the same problem.
The code which I use on other OJS are>

In in /templates/frontend/objects/article_summary.tpl

{translate key=“article.abstract”} {$article->getViews()} | {if is_a($article, ‘PublishedArticle’)}{assign var=galleys value=$article->getGalleys()}{/if}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{$galley->getGalleyLabel()} {$galley->getViews()} |
{/foreach}
{/if}

{* DOI (requires plugin) *}
{foreach from=$pubIdPlugins item=pubIdPlugin}
        {if $issue->getPublished()}
                {assign var=pubId value=$article->getStoredPubId($pubIdPlugin->getPubIdType())}
            {else}
                {assign var=pubId value=$pubIdPlugin->getPubId($article)}{* Preview pubId *}
        {/if}
        {if $pubId}
            {assign var="doiUrl" value=$pubIdPlugin->getResolvingURL($currentJournal->getId(), $pubId)|escape}
                <i class="glyphicon glyphicon-link"></i>{translate key="plugins.pubIds.doi.readerDisplayName"}
                <a href="{$doiUrl}">
                    {$doiUrl}
                </a>
        {/if}
{/foreach}

And also other code>

In /public_html/plugins/themes/bootstrap3/templates/frontend/objects/article_details.tpl

{translate key=“article.abstract”} viewed = {$article->getViews()} times
{if is_a($article, ‘PublishedArticle’)}{assign var=galleys value=$article->getGalleys()}{/if}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{$galley->getGalleyLabel()} downloaded = {$galley->getViews()} times
{/foreach}
{/if}
In public_html/plugins/themes/bootstrap3/templates/frontend/objects/article_summary.tpl

{translate key=“article.abstract”} views: {$article->getViews()} , {if is_a($article, ‘PublishedArticle’)}{assign var=galleys value=$article->getGalleys()}{/if}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{$galley->getGalleyLabel()} downloads: {$galley->getViews()}
{/foreach}
{/if}
In classes/article/PublishedArticle.inc.php.

function getViews() {
$application = PKPApplication::getApplication();
return $application->getPrimaryMetricByAssoc(ASSOC_TYPE_ARTICLE, $this->getId());
}

With these codes on earlier OJS everything works. In OJS 3.1.1.2 these codes don`t work.

When you try to create a report, do you get any file for download?
I received Excel files but in report is everything zero - 0.

Any idea what I can do next? I can test it on two different servers with two different journals.

Regards,
Lazar


#4

Hi @Lazar_Stosic

Hmmm…

OK, it seems that the logging is functioning, because you have the current log file in your usageStats/usageEventLogs/ folder.
Do you maybe have any log files in the usageStats/reject/ or usageStats/archive/ or or usageStats/processing/ or or usageStats/stage/ folder?
There should be daily log files, i.e. since you have installed that OJS. You mentioned that you have only one file, with the current date. Do you have the other files, with the older dates there?

Do you have files starting with “Usagestatisticsfileloadertask-” in your scheduledTaskLogs/ folder, that is in your files folder? If the is such a file, maybe with the most recent date: what is in that file?

Best,
Bozana


#5

Hi @bozana
I tried first to create statistic report and then look at the files and folders.

usageStats/reject/ is empty
In usageStats/archive/ have a lot of event log with data like>
87.116.178.78 - - “2018-07-09 22:55:55” http://xx.xx.xxxx.org/index.php/AE/index 200 “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36”
87.116.178.78 - - “2018-07-09 22:55:56” http://xx.xx.xxxx.org/index.php/AE/index 200 “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36”
87.116.178.78 - - “2018-07-09 22:56:03” http://xx.xx.xxxx.org/index.php/AE/issue/view/1 200 “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36”
87.116.178.78 - - “2018-07-09 22:56:42” http://xx.xx.xxxx.org/index.php/AE/article/download/16/12/23 200 “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36”
87.116.178.78 - - “2018-07-09 22:56:43” http://xx.xx.xxxx.org/index.php/AE/article/download/16/12/23 200 “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36”
66.249.75.10 bot - “2018-07-09 23:28:15” http://xx.xx.xxxx.org/index.php/AE/index 200 “Googlebot/2.1 (+http://www.google.com/bot.html)”
178.220.142.80 - - “2018-07-09 23:40:13” http://xx.xx.xxxx.org/index.php/AE/article/download/27/21/41 200 “Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko”
178.220.142.80 - - “2018-07-09 23:45:31” http://xx.xx.xxxx.org/index.php/AE/article/download/27/21/41 200 “Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko”
66.249.75.12 bot - “2018-07-09 23:55:53” http://xx.xx.xxxx.org/index.php/AE/index 200 “Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)”
66.249.75.8 bot - “2018-07-09 23:58:09” http://xx.xx.xxxx.org/index.php/AE/issue/view/1 200 “Googlebot/2.1 (+http://www.google.com/bot.html)”

usageStats/processing/ is empty
usageStats/stage/ folder is empty

Do you have the other files, with the older dates there?

In usageStats/archive/ folder I have got files with older dates.

Do you have files starting with “Usagestatisticsfileloadertask-” in your scheduledTaskLogs/ folder, that is in your files folder? If the is such a file, maybe with the most recent date: what is in that file?

Yes, I have. Last file is two days old and have next info:

[2018-07-08 12:28:56] http://xx.xx.xxx.org
[2018-07-08 12:28:56] [Notice] Task process started.
[2018-07-08 12:28:57] [Notice] File /var/www/efbl/htdocs/actaeconomica/files/usageStats/processing/usage_events_20180707.log was processed and archived.
[2018-07-08 12:28:57] [Notice] Task process stopped.

As I told you, I had two fresh OJS 3.1.1.2. on two different servers with the same problems. The report in Excel is still 0 and statistic doesn`t work.

Any other idea?

Regards,
Lazar


#6

Hi @Lazar_Stosic

Hmmm… It looks like your files are processed well. Could you then please see what is in your database table metrics? – When the files are processed the statistics are saved in that DB table, and read from there…

Best,
Bozana


#7

Hi @bozana,

In database table metrics I have:

Best,
Lazar


#8

Hi @Lazar_Stosic

Your metrics table seems to be fine. Maybe you can just double check, that also that all log files were processed – the log file name corresponds with the load_id column.
That means that something is just wrong with your display of statistics. Do you also use the display option from the UsageStatistics plugin settings?
And maybe just to double check: when you view your article with the ID = 1, do you see any statistics displayed? Would it be possible that you send me the URL of your journal installation (you could also use the private message)?

Best,
Bozana


#9

Hello
I am presenting the same problem in my OJS 3.1.1, the tasks are executed correctly, they are registered in the database, but the statistics on the site are not shown, they simply appear at 0. If you could give me a help, I read all the threads that deal with the subject and I can not find the solution

Thanks in advance for the help


#10

Hi @rbarbeito

Could you please take a look at this thread: PKP Usage statistics report missing in OJS 3.1.1-4. Could it maybe also be in your case?

Best,
Bozana


#11

hello @bozana

Thank you very much for your help. The thread that you passed me was very helpful to me.

Best regards


#12

hello @bozana
After having solved the previous error through the link that you sent me, I noticed that in some articles the graph of the downloads is shown and in others not, although the latter have downloads made according to the data I get with the solution Previous, you could have an idea about it. :thinking::thinking:

Thanks in advance


#13

Hi @rbarbeito

I believe the graph considers only the downloads in the last 12 months, thus could it maybe be that there was no download for those files in the last 12 months?

Best,
Bozana


#14

Hi @bozana ,
My view statistics in OJS 3.1.1.4 do not work either.
Usage Statistics, Usage event, Acron plugins are enabled.
There are log files in the usageStats/ folder. Permissions in the files folder are set to 777. The subfolders reject, archive are empty and the subfolders stage, processing contain there files with 3 old log files.
However, the DB table metrics is empty.

It would be great if you could help.


#15

Hi @dobry

Hmmm…
Could you take a look what is in your DB table scheduled_tasks where class_name = plugins.generic.usageStats.UsageStatsLoader ?
Also, are there log files (with current dates) in your folder usageStats/usageEventLogs/ ?

Best,
Bozana


#16

Hi @bozana,
Thank you for your reply!
I checked the DB table scheduled_tasks and I found the value “2019-02-27 00:21:27” in column “last_run” under the “class_name” “plugins.generic.usageStats.UsageStatsLoader”.
I also checked the folder usageStats/usageEventLogs/ and found many log files. The last one is usage_events_20190227.log and it was created today.
Best,
dobry


#17

Hi @dobry

it seems like your scheduled task is correctly executed, every day.

Could you also please check the scheduled task log files in the subfolder scheduledTaskLogs in your OJS files folder, that start with Usagestatisticsfileloadertask-...?

Maybe then to test the log file processing first only with one-by-one file:
Move all log files from the subfolders (process and stage) to the subfolder usageEventLogs. Then backup all the usage stats log files and only leave two log files, the oldest log file and the current log file from today, in the subfolder usageEventLogs.
Eventually remove all or just the current scheduled task log file(s) starting with Usagestatisticsfileloadertask-… from the subfolder scheduledTaskLogs.
Then remove the entry in the DB table scheduled_tsks with the class_name = plugins.generic.usageStats.UsageStatsLoader and open an article page, to run the scheduled task again.
Watch in the current scheduled task log file if any error occurs.
Watch if the one old usage stats log file is processed and moved to the subfolder archive (or any other subfolder) and if you have entries for that log file name in your DB table metrics.

To keep the overview and test: take/copy the next old, backuped usage stats log file into the subfolder usageEventLogs and do the same steps again.

Maybe an error occurs while processing on of the old usage stats log file, so that the other cannot be processed…

Best,
Bozana


#18

Dear @bozana,
Thank you for your help!
Unfortunately, I cannot find the file Usagestatisticsfileloadertask* in the subfolder scheduledTaskLogs.
What does it mean?
I will also check the other options that you suggested and will write again.

Update: In the processing and stage subfolder I can only find 3 log files with very old dates: from 2016-07-13 to 2016-07-15. It is about the time when we installed the OJS system. Does it mean anything? Is it normal?

I removed the files from the processing and stage subfolders and left only two log files in the subfolder usageEventLogs (the first and the last one). Then I removed the entry in the DB table scheduled_tsks with the class_name = plugins.generic.usageStats.UsageStatsLoader and opened an article page, to run the scheduled task again.
The entry in the DB DB table scheduled_tsks with the class_name = plugins.generic.usageStats.UsageStatsLoader is present again. So I understand that something has been processed.
However, I noticed no changes in subfolders processing , stage, archive… no new files there.

Please note that I could not find the file Usagestatisticsfileloadertask* anywhere in the OJS system.

Best,
dobry


#19

Dear @bozana,
Any solution to my problem above?
Best,
dobry


#20

Dear Dobry,
Upgrade OJS to 3.1.2. and everything will be done. I had the same problems. On one server work and on other server doesn`t work. When I upgraded it everything work fine. There is some problem in parameters with providers domain, not with OJS.
Regards,
Lazar