Abstract views, PDF views and Download Stats Made Public 😶

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.

Now I do not have access to the server to show, we are doing upgrade, but how come the added code to article,tpl is inherit into pdfViewer.tpl but it displayed only half of it as

View Counter: {translate key=“article.abstract”} | {$article->getViews()} | times, and

and the rest is dropped from

{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{$galley->getGalleyLabel()} | {$galley->getViews()} | times

The variable $galleys only makes sense if you are looking at the article itself, not a particular galley of an article.

If you are looking at the galley, the variable $galley itself will be set by the controller.

Then there is no solution, We shall accept it as it is.

Is there any way to stop the code being displayed in pdfViewer.tpl

It’s not that there isn’t a solution - it is that this solution isn’t just copy-and-paste. To maintain local code changes you should have someone who is familiar with PHP and Smarty who can help you out. Someone with some basic PHP skills should be able to make this change for you.

To be honest I do not want to make too much changes that it will be overwrite with first update. It is requirement of LOCKSS, DOAJ and others that need the METADATA, with no budget we are trying to learn and make best of it. I think DOAJ application require to have this counter. This could be a check box in the setting or a plugin only.

As public university in Kurdistan Region in Iraq we have had our journal on Google Apps for the last 5 years with no issue, but there was no custom METADATA in Google Site. There are not many Open Source IT admins in this region so as Editorial of the journal we try to have stable solution and get on with main issues.


Hi, probably I am missing something (in this case I apologize) but DOAJ doesn’t have such a requirement: it asks only whether a journal provides article download statistics and that is not a requirement.

Perhaps you should check the ALM Plugin (in Generic Plugins) because it provides download statistics in every article page (both abstract page and pdf page) and that is enough to answer “yes” to the question n.30 of DOAJ’s application form.

1 Like

I do not see any ALM Plugin on my Generic Plugin list