Hi,
following code will display total number of visits. I hope it helps you :)
public static string GetPageViews(Object nodeId)
{
int objectId = Convert.ToInt32(nodeId);
DateTime fromDate = new DateTime(1753, 1, 1);
DateTime toDate = new DateTime(9999, 1, 1);
CMS.WebAnalytics.HitsIntervalEnum interval = CMS.WebAnalytics.HitsIntervalEnum.Year;
int count = CMS.WebAnalytics.HitsInfoProvider.GetObjectHitCount(CMS.CMSHelper.CMSContext.CurrentSiteID, objectId, interval, "pageviews", fromDate, toDate);
return String.Format("{0}", CMS.WebAnalytics.HitsInfoProvider.GetObjectHitCount(CMS.CMSHelper.CMSContext.CurrentSiteID, objectId, interval, "pageviews", fromDate, toDate));
}
Additionaly, please make sure that the analytics module is enabled:
Site Manager - Settings - Web Analytics - Enable web analyticsBest regards,
Ivana Tomanickova