Abstract views, PDF views and Download Stats Made Public 😶

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.

Regards,
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.

Regards,
Dein

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

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.

Cheers,
Bruno

5 Likes

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,
Dein

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.

Cheers,
yhwong

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.

Thanks
George

@yhwong,

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.

Cheers,
Bruno

1 Like

@RCVSK,

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.
Regards,
Bruno

Hi @beghelli

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

All the best
George

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

http://aro.koyauniversity.org/article/view/ARO.10113

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

http://aro.koyauniversity.org/article/view/ARO.10113/31

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

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.