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}

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)
https://ojsdergi.com/demo/
I put article statistic in the issue page and article detail page.
issue page
image
article detail page
image

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 3.3.0.8

Journal issue page:
templates/frontend/objects/article_summary.tpl

Artcle detail page:
templates/frontend/objects/article_details.tpl

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
:grinning:

I have external links in my galleys. My galley has PDF, Custom URL 1 & Custom URL 2.

When I added this code, that particular articles now shows “PDF Downloads” 3 times. In the first PDF Download, the actual download number is showing, but in the other two PDF Downloads, it is showing 0.

Also, “PDF Downloads” counter increases for each galley I create for the same article.

Is there a way where I can show just the PDF Downloads once and that too for the PDF Download counter and remove the extra “PDF Download” texts which got auto generated as I added galleys?

Thank you.

Looks like the issue is not on the code to display the abstract/file download views.
I just realized that the articles views/files download stats is not worked.

Anyone experienced this before?

no-rec

I have implemented this code and it counts Abstract Views but always gives PFD Downloads 0.