How to get Page View Count in SPFx in SharePoint Site

Sunita Jodha 21 Reputation points

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

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

    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.



    0 comments No comments

  2. MichaelHan-MSFT 18,021 Reputation points

    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:

    Here is a similar issue in github:

    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