This post was most recently updated on January 11th, 2019.
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. Plus they are sometimes 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/welcome page of a SharePoint Site):
So, what do these managed properties actually contain? They are not all equal – let’s take a closer look!
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.|
So, based on the examples – ViewsLast7Days, for example, is essentially the view count, for the day that “started 7 days ago”. It’s not the views for last 7 days, like the name claims.
Weird, huh? Well, it gets even more interesting!
You can see, that there’s no properties available for “Views for last week”. You can, however, get the views for last 14 days by using ViewsRecent -property. It’s not 2 calendar weeks, though – so be mindful when using it!
Oh – and on-premises, it’s not necessarily 14 days either. You can change it with PowerShell.
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. But I’ve been wrestling with these properties for quite a bit!
How to interpret the values for different properties?
Looking at the samples 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. Or they might’ve had different teams working on different time scales – who knows.
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 don’t have Enterprise features enabled, you don’t have the metrics receivers enabled, you’re out of disk space on crawler/indexing application server, or something similar.
- Are you on 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)
- Fixing “An assembly specified in the application dependencies manifest [projectname].deps.json was not found” - February 13, 2019
- What is “fp.js” – and why is it snooping on your SharePoint usage? - February 6, 2019
- Google Plus is shutting down – fix your .NET OAuth flow! - February 4, 2019
- Solving yet another “Microsoft.SharePoint.Client.ServerException: Unknown Error” - January 29, 2019