Article statistics showing 0 abstract views and 0 PDF downloads

I am actually looking for the statistics (views) which is still 0. My other things are working correctly. So what should i look here?

We have nearly the same issue, but article and full issue downloads are all zero for all our journals, while the abstract views counter works correctly.

@varshilmehta, let me see if I understand where we are at with this issue.

  • You are adding custom code to the templates to display views and download counts
  • You have make some changes to the core ArticleGalleys class, but not the Articles class, at @bozanaā€™s recommendation
  • Youā€™ve confirmed that views and downloads are being captured in the database table metrics

Are all those statements true? Are you still experiencing blank or truncated pages with the latest code changes? Can you re-post exactly what you have currently changed, and the context of the changes to this forum or to GitHub?

@Ph_We, can you confirm the same question Iā€™ve asked above?

Nope, we did not modify any code. Iā€™m talking about the standard Statistics module (Toolsā€“>Statistics).

So for you, @Ph_We, Article Galley downloads and Issue Galley downloads are not being captured in the metrics table?

Have you investigated the output of the scheduled task log for the ā€œUsagestatisticsfileloadertaskā€ (or translation thereof) to see if it provides any clues?

Unfortunately, I have only the OJS admin access now. So I can only judge by those CSVs generated (yes, all downloads for all journals are zero). Tomorrow I may try to investigate further. Should we check the metrics table (how can it be obtained?)?

The scheduled task logs should be emailed to the siteā€™s principal contact if any error is detected.

From: Your Cron/Acron Process
Sent: Monday, July 27, 2015 1:56 PM
To: Your Site Contact
Subject: Usage statistics file loader task - 55b670a178813 - Error

You OJS installation automatically executed and finished this task and you can download the log file here: http://yoursitename/ojs/index.php/index/admin/downloadScheduledTaskLogFile?file=Usagestatisticsfileloadertask-55b670a178813-20150727.log

Can you get these messages from your Site Administrator?

You would need mysql access to check the metrics table. Do you have access to phpMyAdmin or a similar tool?

I am the Site Administrator and the ā€˜principle contactā€™, but I do not get any such messages neither by email, nor by any other means. The Notifications tab in my Profile is absolutely empty :frowning:
What should I do to enable them?

No, I do not have any SQL tools now. Iā€™ll have to do requests to our technical staff :frowning:

It is possible that OJS is not detecting any error condition when processing your logs into metrics. This would bypass the emails, assuming that the config.inc.php setting ā€˜scheduled_tasks_report_error_onlyā€™ is ā€œOnā€, which is the default. If you changed this setting to Off, you would receive the notifications regardless of whether an error was detected or not. If you have filesystem access, you can browse to the logs under your files_dir, in the ā€œscheduledTaskLogsā€ folder.

Thank you, Iā€™ll be back as soon as I get any additional info.

Yes. I have added as follows

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}</br>
{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());
	}

My problem: The abstract view is showing 0 on site as well in stats reports of the journal, however the download count is working normally.
Website: www.jmri.org.in
Log FIles: http://varshilmehta.weebly.com/uploads/5/4/5/1/54510983/php_error.log
I do have PHPmyadmin. So do let me know if you want me to do something with it.

@varshilmehta

Could you also show a few rows examples from your DB table metrics, where assoc_type = 1048585 ?

Thanks!
Bozana

Hi @ctgraham, @bozana!

Here are some errors from our log:

[Fri Jan 13 13:40:38.728852 2017] [:error] [pid 3655] [client 10.***.8.1:36426] PHP Fatal error: Smarty error: [in file:/var/www/html/plugins/citationFormats/refWorks//citation.tpl line 22]: syntax error: mismatched tag {/if}. (Smarty_Compiler.class.php, line 2338) in /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/Smarty.class.php on line 1094

[Fri Jan 13 15:38:03.208234 2017] [:error] [pid 3655] [client 10.***.8.1:36780] PHP Fatal error: Call to a member function getId() on null in /var/www/html/pages/article/ArticleHandler.inc.php on line 76

Here is a sample from our metrics table (assoc_type = 1048585):

[details=Metrics]mysql> select * from metrics where assoc_type = 1048585;

+---------------------------+------------+----------------+-------------------+-----------------+---------------+-------------------+------------+----------+----------+--------+-----------+------------+--------+------+--------------+--------+
| load_id                   | context_id | pkp_section_id | assoc_object_type | assoc_object_id | submission_id | representation_id | assoc_type | assoc_id | day      | month  | file_type | country_id | region | city | metric_type  | metric |
+---------------------------+------------+----------------+-------------------+-----------------+---------------+-------------------+------------+----------+----------+--------+-----------+------------+--------+------+--------------+--------+
| usage_events_20161129.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161129 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |      7 |
| usage_events_20161130.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161130 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161201.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161201 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161202.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161202 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161205.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161205 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      4 |
| usage_events_20161205.log |          2 |              4 |               259 |               1 |             6 |              NULL |    1048585 |        6 | 20161205 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161205.log |          2 |              3 |               259 |               2 |            19 |              NULL |    1048585 |       19 | 20161205 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      3 |
| usage_events_20161206.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161206 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      4 |
| usage_events_20161207.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161207 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161208.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161208 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |     18 |
| usage_events_20161209.log |          2 |              3 |               259 |               1 |             3 |              NULL |    1048585 |        3 | 20161209 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161209.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161209 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      6 |
| usage_events_20161210.log |          2 |              4 |               259 |               1 |             6 |              NULL |    1048585 |        6 | 20161210 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161210.log |          2 |              5 |               259 |               1 |             9 |              NULL |    1048585 |        9 | 20161210 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161211.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161211 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      2 |
| usage_events_20161212.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161212 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      5 |
| usage_events_20161212.log |          2 |              5 |               259 |               4 |            45 |              NULL |    1048585 |       45 | 20161212 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161213.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161213 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      2 |
| usage_events_20161213.log |          2 |             16 |               259 |               8 |            97 |              NULL |    1048585 |       97 | 20161213 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161214.log |          2 |              4 |               259 |               1 |             5 |              NULL |    1048585 |        5 | 20161214 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161214.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161214 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161214.log |          2 |              5 |               259 |               4 |            45 |              NULL |    1048585 |       45 | 20161214 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161216.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161216 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      3 |
| usage_events_20161216.log |          2 |             16 |               259 |               8 |            97 |              NULL |    1048585 |       97 | 20161216 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      4 |
| usage_events_20161217.log |          2 |              5 |               259 |               2 |            23 |              NULL |    1048585 |       23 | 20161217 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161217.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161217 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161218.log |          2 |              9 |               259 |               1 |            14 |              NULL |    1048585 |       14 | 20161218 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161218.log |          2 |              5 |               259 |               4 |            44 |              NULL |    1048585 |       44 | 20161218 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161218.log |          2 |             16 |               259 |               8 |            97 |              NULL |    1048585 |       97 | 20161218 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      3 |
| usage_events_20161218.log |          2 |             16 |               259 |               8 |            99 |              NULL |    1048585 |       99 | 20161218 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161218.log |          2 |             16 |               259 |               8 |           100 |              NULL |    1048585 |      100 | 20161218 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      2 |
| usage_events_20161218.log |          2 |             16 |               259 |               8 |           101 |              NULL |    1048585 |      101 | 20161218 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
+---------------------------+------------+----------------+-------------------+-----------------+---------------+-------------------+------------+----------+----------+--------+-----------+------------+--------+------+--------------+--------+

32 rows in set (0.01 sec)

mysql>
[/details]

[details=Other Metrics]mysql> select * from metrics;

+---------------------------+------------+----------------+-------------------+-----------------+---------------+-------------------+------------+----------+----------+--------+-----------+------------+--------+------+--------------+--------+
| load_id                   | context_id | pkp_section_id | assoc_object_type | assoc_object_id | submission_id | representation_id | assoc_type | assoc_id | day      | month  | file_type | country_id | region | city | metric_type  | metric |
+---------------------------+------------+----------------+-------------------+-----------------+---------------+-------------------+------------+----------+----------+--------+-----------+------------+--------+------+--------------+--------+
| usage_events_20161128.log |          1 |           NULL |              NULL |            NULL |          NULL |              NULL |        256 |        1 | 20161128 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |      6 |
| usage_events_20161129.log |          1 |           NULL |              NULL |            NULL |          NULL |              NULL |        256 |        1 | 20161129 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |      4 |
| usage_events_20161129.log |          2 |           NULL |              NULL |            NULL |          NULL |              NULL |        256 |        2 | 20161129 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |     35 |
| usage_events_20161129.log |          3 |           NULL |              NULL |            NULL |          NULL |              NULL |        256 |        3 | 20161129 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |      9 |
| usage_events_20161129.log |          2 |           NULL |              NULL |            NULL |          NULL |              NULL |        259 |        1 | 20161129 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |     17 |
| usage_events_20161129.log |          2 |           NULL |              NULL |            NULL |          NULL |              NULL |        259 |        3 | 20161129 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161129.log |          2 |           NULL |              NULL |            NULL |          NULL |              NULL |        259 |        4 | 20161129 

[/details]

For the first error, this bug is fixed in master here:

I think we would need to see an example URL and stack_trace on the second error to get a better idea of what is going on here.

The assoc_type of 1048585 represents article abstract views, which we think are working for you. Can you identify a submission (submission_id) which you think should have galley downloads for a particular log (load_id) and show the records from the metrics table for that?

I think it would be harder to identify submission_id, but assuming all download statistics is empty, what kind of request should we do to get all galley download stats? Thanks.

For OJS, submission id is really just the article id which appears in the URL.

Iā€™m considering two possibilities:

  1. Your metrics are recording galley downloads, but your code is not fetching them correctly.
  2. Your metrics are not recording galley downloads, and your code is correctly fetching the empty set.

Iā€™m hoping a query into the metrics table will help determine which of the above is the case. When GitHub comes back up Iā€™ll be able to link you out to the expected values for assoc_object_type and assoc_id.

mysql> select * from metrics where submission_id = 1;
+---------------------------+------------+----------------+-------------------+-----------------+---------------+-------------------+------------+----------+----------+--------+-----------+------------+--------+------+--------------+--------+
| load_id                   | context_id | pkp_section_id | assoc_object_type | assoc_object_id | submission_id | representation_id | assoc_type | assoc_id | day      | month  | file_type | country_id | region | city | metric_type  | metric |
+---------------------------+------------+----------------+-------------------+-----------------+---------------+-------------------+------------+----------+----------+--------+-----------+------------+--------+------+--------------+--------+
| usage_events_20161129.log |          2 |              3 |               259 |               1 |             1 |                 1 |        515 |        1 | 20161129 | 201611 |         2 | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161129.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161129 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |      7 |
| usage_events_20161130.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161130 | 201611 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161201.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161201 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161202.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161202 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      1 |
| usage_events_20161205.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161205 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      4 |
| usage_events_20161206.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161206 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      4 |
| usage_events_20161212.log |          2 |              3 |               259 |               1 |             1 |              NULL |    1048585 |        1 | 20161212 | 201612 |      NULL | NULL       | NULL   | NULL | ojs::counter |      5 |
+---------------------------+------------+----------------+-------------------+-----------------+---------------+-------------------+------------+----------+----------+--------+-----------+------------+--------+------+--------------+--------+
8 rows in set (0.00 sec)

mysql>

It seems there is 1 access on the file with id = 1 of that article 1 ā€“ the first row in the table above. All other rows are the article abstract page.

@Ph_We, where do you look after the views i.e. where do you see they are 0 ?

The problem is it is not reflected in reports. Here is an excerpt from the default CSV report:

"Article ID","Article Title",Issue,"Date Published","Abstract Views","Total Galley Views","PDF"
1," The Lost Tribe of Ethnomethodology","Vol 15 No 3 (2016)",2016-03-30,23,0,0
2," Informally on Informal","Vol 15 No 3 (2016)",2016-03-30,0,0,0

It is also strange there are no data for 2017. Iā€™ve downloaded it over 10 times todayā€¦

P.S. We did not modify any code.