Introduction
We often see in many of the sites that the total page view count is shown. I have come across one of the use cases where I wanted to show how many times that page was visited by any user uniquely.
Scenario
We will see 1 scenario in the article.
Objective
The objective of this requirement is very demanding as it is often seen total number of views on the page and how many people provided their views on any article. We will keep patching the latest count to a list row and keep showing on the power apps.
Step 1. The list structure would look like below.
The list structure could be designed as per our needs. Here for the demo, I have created 2 different lists and shown the data with its list structure.
Article list structure

Article list content

The second list will save data from powerapps and the list structure looks like below.

Step 2. Design screen and form as per requirement.
The below screenshot shows all the articles that are entered, on clicking on articles, we can see the details of the article and all the views that we got on that article. To show all articles, I have taken gallery control.

Below is the display form which shows the variable View value. Variable View value shows gallery-selected item details.

Step 3. Save the Logged User in a Global variable.
We keep logged-in user details in a global variable for performance improvement. Otherwise User().Email could directly be used wherever required.

Step 4. Add a list of DataSource from SharePoint
Add PageViewCountItemWise List from SharePoint as DataSource.
So that the patch function can use this data source to store the views and show them back on the PowerApp.

Step 5. Patch the count on the OnVisible Property of the page. Show unique total views on a page on powerapps or how many and who all people have seen/visited the page.
We will patch on OnVisible property. If it's first a first-time entry then the patch function will create a new record other it will not do anything because we are only showing a uniquely visited people list.

Note. OnVisible property only runs after the screen is loaded. We have to manually load the screen for the first time. Go to any other screen and come back to this screen to run the OnVisible property.













Join the conversation! Your thoughts help the community grow.