Where does "Popular this week" data come from?

362 views
Skip to first unread message

esg...@gmail.com

unread,
Jan 7, 2016, 1:31:21 PM1/7/16
to ICA-AtoM Users
Hello, i am testing Atom 2.2 right now, and found very useful the widget "Popular this Week", but I would like to know:

1- Where does this data come from? I mean, is the number of visits saved in a DB table, or calculate from a .log file or how?

2- How can I know this information for any specific record or image that I would like to know number of visits it had had in any given period of time?

3- Is there a widget or something I missed, that allows me to add this information in the Web interface whenever accesing a record or image (showing in there the number of visits it had had)

4- Finally, if I need a report of number of total access to all records or images in a specific period time, is modifying this widget the way to go, or looking up database directly or log data?

Thanks for your time and hopefully this is the right place to ask this questions.

Dan Gillean

unread,
Jan 7, 2016, 2:00:41 PM1/7/16
to ICA-AtoM Users
Hi Omar,

Good questions!

First, some basic information about the Popular this week widget can be found in our documentation:

From the docs:

The “Popular this week” listing, found on the left-hand side of the AtoM homepage, includes a list of links to the 10 most visited resources available to public users in the last 7 days. Resources listed in the “Popular this week” menu include: archival descriptions, authority records, and archival institutions.

There is no specific week-based start date to the aggregation of these statistics - they are calculated based on the last 7 days of activity. Similarly, the statistics are calculated only on a count of page views - meaning that a single user returning to a resource twice in the same visit will be counted as 2 views.

Currently there is no way to configure the Popular this week settings. Administrators who are interested in more granular analytics information are encouraged to use a third-party analytics tool - for more information, see: Web analytics in the Administrator’s Manual.

For more specific information about extracting this data from the database and targeting specific records, I'll have to ask one of our developers to respond - there's currently no other place to get this information via the user interface. You can see which descriptions have been added or edited in the last 30 days via the Description updates module, however this does not include a count of page views, it merely indicates which records have recently been changed.

AtoM does have basic support for Google Analytics baked in - if you have an Analytics API key, you can add it directly to one of AtoM's configuration files. See:

This may be the simplest solution for you to start getting numbers.

We did do some custom development a while back that would create an analytics page per repository - however, the way it was initially coded was not performant and scalable enough for us to include in a public release. We would like to see this included in a future release, but it will require further development: I think the best way to do this would be to make the report generation asynchronous by moving it to a job executed by the job scheduler introduced in AtoM 2.2. For Artefactual to take on this development, we would need someone to sponsor the work - if your institution is interested, please feel free to contact me off-list and we would be happy to prepare an estimate (I'm hoping it would not be too large, as the bulk of the work has been done). If you are a developer (or have access to developers) and would be interested in doing this work and sharing it back with the project as a pull request, let me know and I can have our developers offer some suggestions via the User forum. Here's a screenshot:




I'll see if any of the developers can offer more insight as to what is stored in the database and how to access this data.

Cheers,

Dan Gillean
, MAS, MLIS

AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory

--
You received this message because you are subscribed to the Google Groups "ICA-AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To post to this group, send email to ica-ato...@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/11e64e0a-2f79-4b51-96e9-57019327ae63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jenny Mitcham

unread,
Jan 8, 2016, 4:56:57 AM1/8/16
to ica-ato...@googlegroups.com
Hi - can I just jump on the back of this thread with a related query?

We are interested in replacing the 'Popular this week' listing with a 'Newest additions' feature which would list the most recently added archival descriptions. This is something I saw on the Mills Archive AtoM page (http://catalogue.millsarchive.org/). I think this feature would be far more useful to our users.

I understand this is a change that a developer would need to make but I wondered if you were able to provide any instructions as to how we could do this ourselves.

Many thanks,
Jen


For more options, visit https://groups.google.com/d/optout.



--
Jenny Mitcham
Digital Archivist
Borthwick Institute for Archives
University of York
Heslington
York
YO10 5DD

Telephone: 01904 321170

Borthwick Institute website: http://www.york.ac.uk/borthwick/
Digital archiving blog: http://digital-archiving.blogspot.co.uk/
Twitter: @Jenny_Mitcham
Skype: jenny_mitcham





Omar Esgaib

unread,
Jan 8, 2016, 7:58:37 AM1/8/16
to ICA-AtoM Users
Hello Dan, thanks for the quick response, so far we are still in testing the Web App , so in the meantime I won´t be allowed any budget money on it, by the end of the month I will have a more clear response on this.

After reading about the tools that read the Web server .logs, the way URL are coded, some reports could be made using Excel about access to some information, though access to digital objects such as images could be more tricky since the names of the images or their thumbnails do not seem related to information on the DB as I read.

Anyway, if there is some information on the views is saved on the DB or somewhere else, could be interesting to know about it.

To Jenny, the "Newest Additions" is on the admin site of the web, on my installation at least on "{my_URL}/index.php/search/descriptionUpdates", so probably somebody more experienced here could tell you where to find that code and use in the home page or something.

mi...@artefactual.com

unread,
Jan 8, 2016, 2:53:15 PM1/8/16
to ICA-AtoM Users
Hi Jenny,

If you'd like to replace "popular with week" with "newest additions" you can do so by replacing the contents of two files with custom code:

* Replace the contents of apps/qubit/modules/default/actions/popularComponent.class.php with the contents at this URL:

  https://gist.githubusercontent.com/anonymous/91017db7f67abc06551c/raw/3b0542e8813bc2c295a33dfb471d7f99b50e52f2/popularComponent.class.php

* Replace the contents of apps/qubit/modules/default/templates/_popular.php with the contents at this URL:

  https://gist.githubusercontent.com/anonymous/324a9551107450889875/raw/0d9c6b82e593e8120c59b9b50aec27a3745ab0c5/_popular.php

Then, after you clear your cache, you should see "Newest additions" on your AtoM site's homepage.

Cheers,
Mike Cantelon
Artefactual Systems

mi...@artefactual.com

unread,
Jan 8, 2016, 5:04:25 PM1/8/16
to ICA-AtoM Users
Hi Omar,

1- Where does this data come from? I mean, is the number of visits saved in a DB table, or calculate from a .log file or how?

The data comes from the access_log database table. Each time an AtoM description is
viewed a row is added to the access_log table.

The SQL query used for the widget counts the number of time each published description has been viewed
in the last week and can be found in this file:


2- How can I know this information for any specific record or image that I would like to know number of visits it had had in any given period of time?

In order to get a count of views for a specific description for the last week, you could use an SQL query
(replacing "someslug" with the slug of the resource you'd like a count for):

SELECT access_log.object_id, COUNT(access_log.object_id) AS count
  FROM access_log
  WHERE access_date BETWEEN DATE_SUB(NOW(), INTERVAL 1 WEEK) AND NOW()
  AND object_id=(SELECT object_id FROM slug WHERE slug='someslug')
 
To get the count over a different period of time you'd change "INTERVAL 1 WEEK" to something else ("INTERVAL 15 DAY" for example).

3- Is there a widget or something I missed, that allows me to add this information in the Web interface whenever accesing a record or image (showing in there the number of visits it had had)

I don't think there's widget for this currently, unfortunately.

4- Finally, if I need a report of number of total access to all records or images in a specific period time, is modifying this widget the way to go, or looking up database directly or log data?

To get a report, you could modify the SQL query (in the file https://github.com/artefactual/atom/blob/qa/2.3.x/lib/model/QubitAccessLog.php) or you run an SQL query manually (if you run it using something like PHPMyAdmin you could export the results as a CSV file).

This SQL query will return a count of total accesses to all records, in reverse order of number of accesses:

SELECT access_log.object_id, slug.slug, COUNT(access_log.object_id) AS count
  FROM access_log
  LEFT JOIN slug ON (access_log.object_id=slug.object_id)
  GROUP BY(access_log.object_id)
  ORDER BY count DESC

Cheers,
Mike Cantelon
Artefactual Systems
 

karen.s...@utoronto.ca

unread,
Jun 7, 2016, 4:07:48 PM6/7/16
to ICA-AtoM Users
The U of T instance has adjusted the code to change "popular this week" to "newest additions" (as per the instructions Mike gave below). We are interested in going a step further - to restricted that list only to newly-added top-level descriptions - not all levels. Before we delve too deep in investigating what code would be required, is there an easy modification that you can suggest, or has anyone already done this?

Thanks in advance!
Karen Suurtamm (U of T Archives)

mi...@artefactual.com

unread,
Jun 9, 2016, 3:58:04 PM6/9/16
to ICA-AtoM Users
Hi Karen,

To restrict the list to newly-added top-level descriptions you could change the query to something like this:

SELECT access_log.object_id, slug.slug, COUNT(access_log.object_id) AS count
  FROM access_log
  INNER JOIN slug ON (access_log.object_id=slug.object_id)
  INNER JOIN information_object ON (slug.object_id=information_object.id)
  WHERE information_object.parent_id=1
  GROUP BY(access_log.object_id)
  ORDER BY count DESC
Cheers,
Mike Cantelon
Artefactual Systems

karen.s...@utoronto.ca

unread,
Jun 21, 2016, 8:44:54 AM6/21/16
to ICA-AtoM Users
Thanks so much, Mike!

Jim Adamson

unread,
Aug 19, 2016, 1:16:04 PM8/19/16
to AtoM Users
Hi Mike and Karen,

We have used Mike's code posted in this thread on 8 January to replace "popular this week" with "newest additions". We would also like to do what Karen has asked for - filtering on top-level descriptions - but as far as I can tell, Mike, your suggested SQL changes in your post of 9 June apply to those still using the original "popular this week" code. Is that right or have I misunderstood?

We have tried to adjust your 8 January version of popularComponent.class.php to filter on top-level descriptions, by changing the embedded SQL, but although results are returned the filtering isn't working as expected and non-top level descriptions continue to be returned. I don't have a good understanding of the table relationships and how this might be achieved. Do you have any suggestions?

Thanks very much,

Jim Adamson
University of York

Mike G

unread,
Aug 23, 2016, 2:41:03 AM8/23/16
to AtoM Users
Hi Jim,

Oops, you're totally right. If you don't care about new actors and repositories, you can use the getNewestAdditions here that I just whipped up.

If you do need actors and repositories in there as well, it gets more complicated. I tried starting to do it myself but it looks like it might be beyond the scope of free support time-wise.

I hope this helps,

cheers

Jim Adamson

unread,
Aug 25, 2016, 5:05:31 AM8/25/16
to AtoM Users
Hi Mike,

That's exactly what we want, and we have made your code live. Thank you very much! We really appreciate your time on this.

Thanks, Jim
Reply all
Reply to author
Forward
0 new messages