How to get total PDF downloads count in OJS 3.3.x.x

Description of issue or problem I’m having:

Hello Friends, I want to ask How to get the total galleys downloads count OJS 3.3.x.x and add it in the article_details.tpl file under the DOI URL like this. How about the code?

I’ve tried this code but it doesn’t work and the PDF download count doesn’t show up.

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

Application Version - e.g., OJS

I want the PDF Download stats to look like this


1 Like

Hi @Lie_Nuk,

A few follow-up questions:

  1. The image that you posted what you want the Download stats to look at, is there a URL as well where you point us to to have a look at this.
  2. What specific version are you using for OJS. I know you have it as 3.3.x.x, but if you could indicate the specific version that you’re working on to make the changes, that would be helpful, as there might be variations in the codebase from version to the next.


PKP Team

I am currently using OJS,
Here is the URL for the image above

I use the code from this blog tutorial (Indonesian)

Hi @Lie_Nuk,

Thanks for sharing this. One thing you may be able to do out of the box is use the Usage Statistics plugin - that does display some download statistics. You can read more about it in this thread: OJS 3 - Download statistics - #12 by bog

However, this might not be exactly what you’re looking for.

I’m not sure how exactly to go about getting this exactly the same, so I will ask some of my team members to comment when they are able to/available. You may wish to reach out to the developers of the site that you’d linked to to see if they are able to share their code - that might be a bit quicker.

Best regards,

PKP Team

Hi @rcgillis,
Is there any update regarding this?

I experienced the same issue on OJS

Previously I used the below code on OJS 3.1 and it’s worked as expected.
Unfortunately, it’s only returned 0 when I tried to implement it on OJS

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


Kind regards,

Adi Pratama

If your journal is monolingual, you can use the following code:

{assign var=galleys value=$article->getGalleys()}
Abstract views: {$article->getViews()}
{if $galleys}
    {foreach from=$galleys item=galley name=galleyList}
       / PDF downloads: {$galley->getViews()}

Hi Kerim,
I only use one language on my OJS (see attached image).

May I know the URL of the journal that you managed?

Thank you.


Here you are…
(This is a demo site)
I put article statistic in the issue page and article detail page.
issue page
article detail page

Thank you for sharing this screenshot.

May I know to which file did you add the code?

what version of OJS do you use?

I added this code article summary page and article detail page
My OJS Version

Journal issue page:

Artcle detail page:

Thank you. We have successfully used your tutorial on our journal website Level of Compliance with the Use of Oral Antidiabetes Drugs in DM Patients at Rampal Support Hospital (Rumkitban) Malang | PHARMADEMICA : Jurnal Kefarmasian dan Gizi