OJS Usage Statistics

you could insert that code for example here: https://github.com/pkp/ojs/blob/master/templates/frontend/objects/article_details.tpl#L137

But you would also need to move this line https://github.com/pkp/ojs/blob/master/templates/frontend/objects/article_details.tpl#L209 in front of that code that you are , i.e. something like:

{translate key=“article.abstract”} viewed = {$article->getViews()} times
{assign var=galleys value=$article->getGalleys()}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{$galley->getGalleyLabel()} | {$galley->getViews()} | times
{/foreach}
{/if}

If you do not need the galleys counts, you can only use this:

{translate key=“article.abstract”} viewed = {$article->getViews()} times

2 Likes

Hi @bozana
I have inserted the codes in article_details.tpl and moved the

{assign var=galleys value=$article->getGalleys()}

In my article_details.tpl, it is as follow

After saving, I have not seen any abstract view stats in article display http://jurnalbeta.ac.id/index.php/betaJTM/article/view/108

Anything missed?

Hi @kawahyu

Hmmm… Your article view page looks different than the standard OJS. Did you maybe make some changes, do you use another theme or so?

Best,
Bozana

I use Manuscript Jats Theme by @Vitaliy. Is there any effects for the abstract views?
Wish @Vitaliy has chance to give any words
I will try another theme, see what is the result

Hi @bozana
The statistics are displayed in default theme. But, the format is not set well I think.
http://jurnalbeta.ac.id/index.php/betaJTM/article/view/83
Any idea to fix them?

@kawahyu

This is what that code part does. How would you like to have them? – It is not easily possible to display them in a graph, just as a text…

For the other theme: you would need to find the template in that plugin folder, that you need to change…

A text is fine.

Abstract viewed = 0 times PDF (Bahasa Indonesia) | 231 | times

Does 231 refer to PDF view?
Could I customize to be like?

Abstract viewed = 0 times | PDF (Bahasa Indonesia) viewed = 231 times

I think, abstract view does not work

It seems {translate key=“article.abstract”} viewed = {$article->getViews()} times refer to Abstract viewed = 0 times.

Are the codes for customizing PDF (Bahasa Indonesia) viewed = 231 times in artcle_details.tpl?

@kawahyu

One change: The funciton in ArticleGalley class should look like this: pkp/pkp-lib#2167 fix assoc type in getViews for article galleys · pkp/ojs@32c6678 · GitHub
Apparently you do not need the getView function in the Article class, because there is that function in the PublishedArticle class.

Concerning abstract views = 0: Apparently you do not have any entries in your DB table metrics with assoc_type = 1048585 and assoc_id = 83 (the article example you are looking at) from this year. But there are some views for article 1, s. http://jurnalbeta.ac.id/index.php/betaJTM/article/view/1.
You would need to investigate why are there no entries for article 83 – maybe they will come in a day or so…

This code displays the galley views:

{$galley->getGalleyLabel()} | {$galley->getViews()} | times

Thus change it to:

{$galley->getGalleyLabel()} viewed = {$galley->getViews()} times

to get the text you wish…

maybe they will come in a day or so…

I hope so. Just wait another day

I think the usage event log does not show real time access in DB metrics. Today is 28-07-2017 but it shows 27-07-2017
Is it normal?

All front-end is stored here: defaultManuscript/templates/frontend at master · Vitaliy-1/defaultManuscript · GitHub

Thanks to OJS elaborated programming style you can easily transfer front-end the code between themes. Just find the code that is responsible for abstract views.

Thanks @Vitaliy for the hint
I inserted the following codes in /templates/frontend/objects/article_details.tpl

but the abstract view stats don’t show.
Is it the way to display the abstract view stats?

Give me a link where you originally found this peace of code. Default theme I suppose?

The codes suggested by @bozana, I inserted in template/frontend/objects/article_details.tpl
Using default and manuscript theme, abstract view stats displayed. However, when I change to Manuscript Jats the abstract view stat does not show. When you give this hint

All front-end is stored here: https://github.com/Vitaliy-1/defaultManuscript/tree/master/templates/frontend1
Thanks to OJS elaborated programming style you can easily transfer front-end the code between themes. Just find the code that is responsible for abstract views.

I think the same codes suggested can be inserted in https://github.com/Vitaliy-1/defaultManuscript/tree/master/templates/frontend/objects/article_details.tpl

How can I display abstract view stats using manuscript jats theme?

So you inserted this code in the article_detail.tpl in default manuscript theme and it worked but in jats manusctipt theme it is not working?

Yup…

Pengembangan perangkat pembelajaran matematika dengan pendekatan kontekstual budaya Lombok | Beta: Jurnal Tadris Matematika, no abstract view stats displayed

The code should work.

But I have commented out the original abstract field and placed it the JATS Parser Plugin here: https://github.com/Vitaliy-1/JATSParserPlugin/blob/master/templates/abstract.tpl

Maybe try put code there?

1 Like

Hi @Vitaliy thanks for that.
The abstract view stats displayed after inserting the codes in abstract.tpl
http://jurnalbeta.ac.id/index.php/betaJTM/article/view/83

Is it possible to display the abstract view stats in metrics?

Hi @bozana

Concerning abstract views = 0: Apparently you do not have any entries in your DB table metrics with assoc_type = 1048585 and assoc_id = 83 (the article example you are looking at) from this year. But there are some views for article 1, s. http://jurnalbeta.ac.id/index.php/betaJTM/article/view/1.
You would need to investigate why are there no entries for article 83 – maybe they will come in a day or so…

I found no abstract view report except on 2016 publication


I am still waiting for another day for the abstract view stats to generate. In case, they don’t appear how I investigate this problem in DB?
I have also carefully read this thread Article statistics showing 0 abstract views and 0 PDF downloads especially on your recommendation.

Here I don’t understand

Maybe here as well, for the others to know: Your DB table usage_stats_temporary_records has some wrong indexes/primary key defined, which leads to the DB error duplicate primary key, so that statistics can not be inserted. You should remove the indexes and then move the unprocessed log files into the folder usageEventLogs, so that they can be processed again.

I also have revised the code (from (‘PublishedArticle’) → (‘article’)

$publishedArticle = $templateMgr->get_template_vars(‘article’);

I am planning to add this feature to my own site also.