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()}
{/foreach}
{/if}
</div>

Application Version - e.g., OJS 3.3.0.3:

I want the PDF Download stats to look like this
pdf

Thanks.

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.

Thanks,

Roger
PKP Team

I am currently using OJS 3.3.0.3,
Here is the URL for the image above
https://ojs.unpkediri.ac.id/index.php/intensif/article/view/14612

I use the code from this blog tutorial (Indonesian)
http://www.kuliahkomputer.com/2020/01/cara-menampikan-statistik-download-dan.html

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,

Roger
PKP Team

Hi @rcgillis,
Is there any update regarding this?

I experienced the same issue on OJS 3.3.0.7.

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 3.3.0.7.

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

Thanks.

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