Monday, June 19, 2017

Finding Most Visited Pages of your Sitecore site

We were looking for a solution where We were supposed to show highly visited news article pages of our site. This application was created with the help of Sitecore CMS. We thought of using Sitecore analytics for the solution.
In Sitecore 8.1 all the interactions done by a user on the site are firstly collected in mongo database as visit data. On the session end event, mongo data is processed and stored in to Sitecore analytics database. All the reporting data shown in the Experince Analytics section of Sitecore is pulled from this database.
Back to original problem, We pulled out the visit data from mongo database for 3o days and then filtered this to get our desired result. Click Here to check one of the ways to pull out the visit data. Now the problem which We faced with this approach was data being captured in mongo database was very large for 30 days which was causing the high CPU usage for our application.
Above problem made us think about another way to find the highly visited new articles. We thought of pulling the data from Sitecore analytics database as it already processed  and has lesser data as compare to mongo collection. The simplest query which we used to pull the data from Sitecore analytics database is
SELECT TOP 3
      [ItemId],
      sum(Views)
  FROM [YourSitecore_reporting].[dbo].[Fact_PageViews]
  group by ItemId
 
Thanks

No comments:

Post a Comment