Abstract views, PDF views and Download Stats Made Public 😶

Dear All,

I am currently using OJS 2.4.7 and were asked by journal accreditation body to make the number of abstract views, PDF views and article download stats available for public viewing. I have browsed through older forums and php files inside the OJS folders to look for clues on pertaining issues but came to no avail. Hence, if anyone here in this forum has any sort of idea on how to come about to solve this issue (a step-by-step guide would be helpful) please reply to this post and your answer would be much appreciated.


Hi @Dein,

Interesting – can I ask what accreditation body is requiring this?

Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I was told by DOAJ to include those information maybe on the article main page. The view count and PDF download count.


DOAJ is a right pain. They impose all sorts of bureaucratic requirements but do not do significant quality checks so some seriously dodgy journals are in their index. I would make a best effort to meet their requirements and not worry if you don’t satisfy every requirement to make maximum points.

It is useful to be included so your journal can be found but I wouldn’t go so far as to call them an accreditation body.

Hi all,

I understand your frustration, Philip, but I’ll stick up for DOAJ here. They’re a small group working on a tough problem that comes with large numbers and no firm boundaries. Distinguishing profiteering publishers from new entrants publishing real science is hard and nobody has really figured out how to do it yet in a way that doesn’t favour existing incumbents (some of whom may also be profiteering) overmuch or skew against e.g. publishers in developing countries. PKP is able to defer to DOAJ’s work on this, which saves us a lot of effort.

Alec Smecher
Public Knowledge Project Team

Hey all,

Thanks @philipmach for your suggestions and @asmecher for your concern. The problem with my boss is that he won’t take no for an answer. He told me that it is incumbent for us to meet their requirements and that the job is not impossible as there is another journal capable of doing so. Please refer to this journal site for an example of what he was expecting to have: http://pagepressjournals.org/index.php/aiol/article/view/5439
Hence, if any of you know exactly how they managed to place in the details of the abstract and PDF views, please let me know.


Hi @Dein,

The code to do that is basically this one:

{translate key="article.abstract"} - {$article->getViews()}
{if $galleys}
        {foreach from=$galleys item=galley name=galleyList}
                {$galley->getGalleyLabel()} - {$galley->getViews()}

This can be used inside the templates/article/article.tpl file directly. Of course you will need to add extra markup to make it look nice, but from the coding perspective, this is it.



Hi @beghelli,

Thank you so much for your kind help. I will try to work on the design later. Thanks mate. Hope others may benefit from this thread.

May the force be with you,

Back to the original question - DOAJ doesn’t appear to require article metrics on the journal site. Am I missing something in their requirements?

I appreciate that they are providing a useful service but I question some of the detail they demand you get right just to be listed. But anyway I made them happy in the end.

I am in a developing country and do not much appreciate publishers who make it harder for us by profiteering practices – including the established publishers, but that is another whole issue…

On a positive note, it is great that there are so many free tools and services out there, which makes it that much easier to publish a journal where funding is tight.

1 Like

Hi @beghelli,

Thank you for the code, I’ve managed to display Abstract and PDF view count.

Just some quick questions:

How does the view count work?
The views don’t seem to increase immediately every time I view both Abstract and PDF.

Does the view count only update daily?
Does the view count only counts unique IP?
Is there a way to configure the views to update immediately?

Does PDF view count include download count as well?

I believe this answer will help us to better understand how this feature work.


1 Like

Hi @beghelli,

Great code, thank you very much!! I wonder if there is a code to display the sum of all views (abstract+galleys)…

I would appreciate any help.



Please, check the stats documentation for those questions: https://pkp.sfu.ca/wiki/index.php?title=PKP_Statistics_Framework

Let me know if there’s anything you need after reading this, so we can also improve the doc.


1 Like


Try this inside any controller that’s preparing the template to be rendered (I would add it to the ArticleHandler controller, in the view method, around line 174, for example):

$articleId = $article->getId();
$metricsDao = DAORegistry::getDAO('MetricsDAO');
$result = $metricsDao->getMetrics($journal->getDefaultMetricType(), array(), array(STATISTICS_DIMENSION_SUBMISSION_ID => $articleId));
$totalViews = $result[0]['metric'];
$templateMgr->assign('totalViews', $totalViews);

Then you just have to use the {$totalViews} inside the templates/article/article.tpl file to show the total count.

That’s a quicker approach then retrieving the galleys stats, counting them, and then getting the abstract and summing everything.

Hope that it helps.

Hi @beghelli

Thank you for your great answer and help. It works.

All the best

Thank you for the instruction here, I did this but in the PDF view page the PDF count does not appear, please see the code below and compare with the page here


View Counter: {translate key="article.abstract"} | {$article->getViews()} | times, and {if $galleys} {foreach from=$galleys item=galley name=galleyList} {$galley->getGalleyLabel()} | {$galley->getViews()} | times {/foreach} {/if}

I see the following output on the page you reference:

View Counter: Abstract | 24 | times, and PDF | 7 | times

Yes, but not in the PDF view page , That is the issue for us


The display of the PDF is actually the display of a particular Article Galley. See:

and thus:

Does it mean that I have to add the code to pdfViewer.tpl as well?

Perhaps. It depends on where you want this to display.

Are you familiar with PHP and Smarty? Note that in the article.tpl, most of the content is wrapped in an if/else which keys on whether or not a $galley is currently set. To display a count on both pages, you could place code outside of this if/else.