0 votes

Page View Counter (Optimized)

Umbraco Page View Counter (Optimized)

this package is a statistics counter for individual pages to display in  front end.

it's the simplest way to show how many times the page has been visited.

Note: this is an optimized way to count the page views, it uses custom database table to store data.

It doesn't save and publish every time the page is requested, so you can use it without worrying about the performance in high traffic websites.

Follow these instructions:

1.Install the Package (Developer > Packages)

2.add the below code to the page template you need to count page views

  @{ 
      int nodeId = Umbraco.AssignedContentItem.Id;
      string cookieName = String.Format("PageView_{0}", nodeId);
      if (Session[cookieName] == null)
      {
          Reflections.UmbracoUtilities.PageViewCounter.SetPageViewCount(nodeId);
          Session[cookieName] = 1;
      }
  }

3.add the below code in the place you need to display the counter in.

 @Reflections.UmbracoUtilities.PageViewCounter.GetPageViewCount(Umbraco.AssignedContentItem.Id)

Please Note if you will uninstall the package you need to delete the below from the database:

  1. Table : ReflectionsUmbracoUtilitiesPageViewCounter
  2. Stored Procedure : ReflectionsUmbracoUtilitiesGetPageViewCount
  3. Stored Procedure : ReflectionsUmbracoUtilitiesSetPageViewCount

Screenshots

Package owner

Omar El Sergany

Omar El Sergany

Omar has 73 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
8.3.x (untested)
8.2.x (untested)
8.1.x (untested)
8.0.x (untested)
7.15.x (100%)
7.14.x (untested)
7.13.x (untested)
7.12.x (untested)
7.11.x (untested)
7.10.x (untested)
7.9.x (untested)
7.8.x (untested)
7.7.x (untested)
7.6.x (untested)
7.5.x (untested)
7.4.x (untested)
7.3.x (untested)
7.2.x (untested)
7.1.x (untested)
7.0.x (untested)
6.1.x (untested)
6.0.x (untested)

You must login before you can report on package compatibility.

Package Information

  • Package owner: Omar El Sergany
  • Created: 09/09/2019
  • Current version 1.0.0.0
  • .net Version 4.7.2
  • License MIT
  • Downloads: 99