How to get Page View Count in SPFx in SharePoint Site

Sunita Jodha 21 Reputation points
2020-12-21T09:29:08.7+00:00

Hi All,

I have a requirement to show most visited Site Pages in custom dashboard in Modern SharePoint site. I need to develop to SPFx component but I am not getting any suitable article/approach to proceed with it. Please suggest on the same.

Thanks in Advance!!

Sunita Jodha

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,250 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Mohamed El-Qassas 1,396 Reputation points MVP
    2020-12-21T09:49:34.967+00:00

    If your goal is getting the popular content and page views, I would suggest checking first the usage data feature instead of building a new customized SPFx.

    In Usage Data, you can find the Popular content that shows the most popular content on the site sorted by site pages, news posts, and documents sorted by unique viewers, total views, or time spent for site pages and news posts.

    Note: the Site Usage feature can only show data for the last 7 days.

    Also, you can check SharePoint site usage in Microsoft 365 admin center that has The Pages chart that shows the number of pages viewed across all sites and more.

    4f88fb7d-9aa8-470e-9e23-e31caaf77d78.png

    Read more at

    0 comments No comments

  2. MichaelHan-MSFT 18,021 Reputation points
    2020-12-22T09:30:17.233+00:00

    Hi @SunitaJodha-6878,

    For page view count in SPFx, currently there is no Official documented Api to fetch views count. You could vote here on UserVoice: https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform/suggestions/35822527-official-documented-api-needed-to-fetch-modern-pag

    Here is a similar issue in github: https://github.com/SharePoint/sp-dev-docs/issues/5072


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments