Select to view content in your preferred language

View Item usage usage by user in Portal

02-12-2021 04:57 AM
Labels (1)
New Contributor

I am running the 10.8 version of the Enterprise base deployment stack with Portal sitting on top.  I want to be able to view which user is viewing which Portal item.  I want to do this so I can understand if our users (>250) are actually accessing the maps we created for them.  For example, is a user in the planning teams actually accessing the planning-focused maps? I can use 'Last login' but that information is way too coarse for my needs.  I have seem the thread "How can I track usage statistics for all items in my AGOL organization?" but it dates from 2017/2018.  My idea is for a set of mature admin tools for Portal that allows for this type of query as my managers are asking me to justify the expenditure on the Enterprise stack.

Tags (4)
6 Replies
MVP Esteemed Contributor

I wonder if that's something you could do with ArcGIS Monitor? Unfortunately, the usage method is only available to AGOL, per the docs.

Here are a couple of other approaches:

Portal Logs

It's still pretty coarse, but you can go to web-adaptor-url/portal/portaladmin and pull logs from there. It won't get you what that user did, but you can at least see the frequency of their logins as opposed to "last login", to get a per-user sense of their overall use of the portal.



More relevant to your question, though, it to get item-level usage stats. The best I think you could hope for is to really strictly enforce group-based access to your content. Perhaps you already do this, but using your example above, if you were certain that only users in the "Planning" group had access to a particular planning-centric map, you could be relatively certain that the view count for that web map consists of views from that group.

Of course, that method still has a major drawback: the view count is cumulative.

Getting View Counts Over Time

Each item in the portal has a property numViews. If you're comfortable with scripting, you could easily pull the view count at regular intervals. Consider the following python code:

from arcgis import GIS
from datetime import datetime

gis = GIS('your-portal-url', 'user', 'password')
full_content_list ='', max_items=-1)

view_counts_dict = {}

for item in full_content_list:
    view_counts[item.title] = [item.numViews,]

The resulting dict object has a key for every content item in your portal (provided the user you logged in with is an admin), and for each item, the number of views and the timestamp.

That dict could easily be manipulated and exported to a running list in Excel that you summarize with a pivot table, converted to a pandas DataFrame, or even submitted as edits to a hosted table in your portal for summarizing in a Dashboard.

Again, none of the above methods is perfect, but hopefully they will help you get closer to the information you're looking for.

- Josh Carlson
Kendall County GIS
0 Kudos
New Contributor II

The code above returns the TOTAL numViews. Is there a parameter in the search query that would return numViews from a begin and end date/time?

0 Kudos
MVP Esteemed Contributor

@JimO_Leary2  Total views are the only thing you can get on Portal; you can't specify time ranges, at least right now. But if you pipe the total views into a table at regular intervals, the resulting table can be sliced by the timestamp and basic math can give you those date-bound counts.

- Josh Carlson
Kendall County GIS
0 Kudos
New Contributor

I figured that was the only way to really get a historical overview. Wish I would have seen this earlier. There is no parameter for a begin and end point in time. It's always like that last sip of water in a cup that just couldn't quinch it.

0 Kudos
New Contributor

Hi there

I was wondering if anyone provided any solution to your query? We are trying to achieve the same thing, i.e. which user is viewing which portal item but I cannot find a way of doing it with the Python API.

Any thoughts/ideas would be very helpful!

Many thanks


New Contributor III

Hi There

Just wondering if anyone has had any luck with this. Would really love to do something similar as initial poster.

Is there anything in ArcGIS Monitor? Or perhaps even PowerBI?