Share via


How to Query SharePoint online modern site page views?

Question

Monday, August 20, 2018 11:43 PM

Currently i am building a SPFx web part to query social components on SP modern site pages, such as comments, likes and views.

I can successfully retrieve the comments and likes following https://www.eliostruyf.com/getting-likes-and-comments-from-modern-pages/, but cannot find a solution to retrieve view counts. After some research, i can see we might be able to use undocumented API to query this information, but this is not what i need, are there any simple ways we can query this information?

All replies (4)

Tuesday, August 21, 2018 4:23 AM

Hi,

As a workaround, we can use Search REST API and managed properties to get page views.

https://****.sharepoint.com/sites/dennis/_api/search/query?querytext='ContentType:*path:https://***.sharepoint.com/sites/dennis'&selectproperties='contenttype,Title,path,ViewsLifeTime,ViewsLifeTimeUniqueUsers'

Here is a similar thread for your reference.

https://sharepoint.stackexchange.com/questions/112779/sharepoint-2013-page-views

Best Regards,

Dennis

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].


Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


Tuesday, August 21, 2018 4:46 AM

Hi Dennis, don't think this approach is working for modern site page, i just tired it, both ViewsLifeTime and ViewsLifeTimeUniqueUsers are NULL.


Tuesday, August 21, 2018 9:46 AM

Hi,

Per my knowledge, there is not other api to get views count.

You can submit a user voice in the link below.

https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform

Best Regards,

Dennis

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].


Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


Tuesday, September 4, 2018 8:31 AM

Hi,

Would you please provide us with an update on the status of your issue?

Best Regards,
Dennis

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].


Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.