My journal’s stats plugin is working normally. I had to unpublish an article to update a pdf file, putting the CrossMark logo and when I publish the new file the statistics no longer appear…
I tried to go back to the previous article, but the statistics don’t show up, although the internal system report shows that the access counts are still there.
The version of our OJS is OJS 220.127.116.11.
Did you unpublish and then create a new galley? or did you just replace the file in the existing galley?
The former would create a new galley id and reset the stats for the galley. The latter should not.
I just replace the file… The old was deleted and the new was add. Then republished.
Today, three days after, the statistics appear, but don’t show the old one (published in 2021.08.01)… See figures below
What you are showing me in that first screenshot is the entire galley, not just the file. If you deleted that and created a new PDF, you’ve deleted the galley and reset your stats. If you clicked “Edit” instead, you would have uploaded a new file and kept the galley, and your stats.
I understood! Grateful for the clarification…
I have the backup of the database and files… Is there a way to rescue these deleted data by recovering the data from the most recent backup? In which tables/files do I find this data?
Can the content in the files/usageStats subfolder, the usageEventLogs subfolder or the database metrics table help or are there other places where these records are written?
That data isn’t “gone”, it’s still in the metrics table in the database. It’s just that now OJS has started accumulating new data for the new representation_id.
So, you could try something, and please do all of this on a test installation if possible - It would be unfortunate for you to corrupt your database.
If you look at the
metrics table you’ll see that each record has a
submission_id column and a
representation_id column (which may be null if it wasn’t a galley view). The
representation_id is the galley id, and what you could do is UPDATE the metrics table and change the representation_id from the old galley id to the new one. So something like:
UPDATE metrics SET representation_id = 'XXX' WHERE submission_id = 'the submission id' AND representation_id = 'the old galley id';
You may be able to look at the old archived usage stats event logs and find the old galley id. It’d be the second number in any “download” link. The first number is the submission id, the third is the file id.
Doing this should assign all of the old stats to the new galley. Please note, though, that if you do this and you ever reprocess your logs you will undo the change because the log files will contain links to the original galley.