Question

I am trying to retrieve the view count of modern SharePoint site page using PowerShell search API.

But the view count on the page and count of viewsLifeTime is different.\

PowerShell output:

enter image description here

SharePoint Page:

enter image description here

Can anyone let me know how can I get view count of page and also page visits count?

Are there any managed properties to get this count? Please help.

Était-ce utile?

La solution

As per this GitHub Issue:

The managed properties ViewLifeTime, ViewLifeTimeUniqueUsers and ViewsRecent, are not the same properties used within the Social bar, that is using a different source. The reason of this behavior is that, classic usage and modern (on the social bar) are from two different sources and we cannot make any comparison between each other.

So, technically its stored or processed from different places. Search query gets it from Search index, But In Social bar Page view, it basically uses Microsoft Internal api (based on fiddler traces ) to fetch Page views (not sure where/how it is being processed). As per the information received by Microsoft support, Microsoft api which fetches Social bar Page view count is not Public api (at least for now), so there is no Official documented api present yet.

Another Interesting fact is that, OOTB News web part also shows Page view count. When I checked the fiddler traces, It basically uses Search query to fetch News pages, but to fetch View count it uses Microsoft internal api again. So OOTB news web part apparently not use Search Managed property (ViewLifeTime, ViewLifeTimeUniqueUsers).

If you want Microsoft to support this then you can vote on below UserVoice:

Official documented Api needed to fetch modern Pages View count

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top