Have you ever wondered, how SharePoint’s Managed Properties for Usage & Analytics info actually work? There are all these nice properties available for getting view counts for different items in SharePoint’s search index, but they all seem to act like crazy. And they are pretty nonsensical… And not very well documented!
In this post I’ll try to make some sense on how you can use them in programmatic scenarios. Read on…
What properties are we talking about?
Ah, yeah. That might be a good way to start the post. We’re talking about all the managed properties, that SharePoint populates for view counts. There really is a bunch of them, and while they’re not very reliable, they might still be useful for fetching the most popular stuff or comparing usage/views of certain items over time.
Over very limited, predefined time, that is. Anyway, let’s look at the list of properties, and what do they mean!
In this post, I’m skipping using the “Unique” -versions of the properties. They’re typically measuring unique users instead of views – but in this example, we’re more interested in view counts, and what do they mean.
How to browse the values for view counts in your environment?
You can access this url to get the view counts for items in your intranet site – feel free to modify it to apply different filtering:
This query basically returns you all web or site home pages with their titles, paths and all available usage properties. As a result, you get something like this (example is a home page of a site):
So, what do these managed properties actually contain?
List of Usage-related managed properties in SharePoint Search Index
You can get the unique views (supposedly, only one per user, but this is probably more like one per sticky session and not actually user-related at all) by appending “UniqueUsers” or “Unique” at the end of the property name. More precisely, for all the other properties, append “UniqueUsers”, but for month-related properties, append “Unique”.
So, the total list of all properties is something like this:
It’s kind of weird how inconsistent this naming is just in general… But hey, it’s SharePoint 🙂
Here’s the list with explanations and example values (I’m omitting the Unique-versions to keep it concise):
|Property Name||Collection time scope||Example value in a typical situation (intranet for a small organization, observation day: Wednesday in September)||Explanation|
|ViewsLast1Days||Non-cumulative; just the value for one day.||351||Views of the last full day – in our case, Tuesday.|
|ViewsLast2Days||375||Views of the day before the last full day, so in our case, Monday.|
|ViewsLast3Days||15||Views of the day before; in our case, Sunday.|
|ViewsLast4Days||6||Views of just Saturday. You know, a day before the last one.|
|ViewsLast5Days||275||Friday. The same thing as before.|
|ViewsLast6Days||472||Thursday. You know.|
|ViewsRecent||Cumulative: 2 weeks (14 days, not calendar weeks)||1042||All of the views of 14 last full days lumped together. However, on-premises this is configurable to be whatever between 1-14 days.|
|ViewsLastMonths1||Cumulative: A full (calendar) month||1278||All of the views of the last full month (e.g. August).|
|ViewsLastMonths2||1329||All of the views of the previous full month (e.g. July).|
|ViewsLastMonths3||1476||All of the views of a month before the one above (e.g. June).|
|ViewsLifetime||Cumulative: Lifetime||85445||Sum of all the views since the document was created.|
These are based on a combination of shoddy documentation and my unreliable observations. Probably goes without saying, that I’m not 100% sure of all of the details.
More info about the property names etc., although I don’t think they’ve gotten all of the descriptions quite right:
How to interpret the values for different properties?
Looking at the example values and explanations before, we can see a few trends from these values. Just from these values, you can quite clearly see the weekend and vacation season (drop in page loads for August). These are very typical for Intranet sites, and you can verify the same trends using a more refined analytics solution (like Google Analytics).
If you want to count together views for last 3 days, you need to calculate:
ViewsLast1Days + ViewsLast2Days + ViewsLast3Days
Similarly, counting visits for last 2 months (in our example, August + July), you’d need to sum together:
ViewsLastMonths1 + ViewsLastMonths2
I don’t know if the naming scheme bothers anyone else, but I think it’s pretty bad. It’s notoriously difficult to change something like that, though, so it’s entirely possible, that Microsoft has changed how the properties work at some point without changing the names.
More info: https://social.technet.microsoft.com/Forums/sharepoint/en-US/6793cffa-14f1-4318-9e02-40e287dfa5ec/timespan-of-search-usage-properties-views?forum=sharepointsearch
Caveat: Sums are not always actually sums.
Because of something called tail-trimming, SharePoint doesn’t actually calculate view counts for days, when view counts are low. Theoretically, only days with really low (under 3) views per day should be omitted from all values, but like with so many other things in SharePoint, I would take this with a grain of salt. Sums of different viewcounts won’t match, though, that’s for sure.
Problem: All of these property values are null!
Ruh-roh! That’s pretty typical. Might be worth another article, but a couple of quick pointers:
- Are you on-premises? You’re either missing mappings, your usage & analytics service is down, you’re out of disk space on crawler/indexing application server, or something similar.
- Are you in O365? Try Using SharePoint Search Query Tool to check if the properties are available and have values. Export a Excel report from Usage / popularity trends to see if the usage service is down. If the report doesn’t work either, open a ticket at Microsoft support.
Latest posts by Antti K. Koskela (see all)
- Thanks for coming to my session at SPS New England 10/20 ! - October 20, 2018
- Speaking at SPS New England on 10/20! - October 17, 2018
- Ignite 2018 recap: What’s new for Azure Functions? - October 16, 2018
- Problematic behavior of web.AddSupportedUILanguage(int lcid) in SharePoint 2013 and 2016 - October 10, 2018