Has a simple label property editor that shows how many times the page has been visited.
It creates a macro, macro partial view, and a data type.
Add the data type to your document type, add the macro to the template, and start counting
This package saves the node everytime it is visited, to increase the counter, so, per Sebastiaan Janssen's suggestion:
Notice that this plugin was developed to simply count the visits, not publish them. In case you need to actually publish the count so you can display it somewhere in your site, please change the macro accordingly (see below):
Macro: (you can paste it over the current code)
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var id = CurrentPage.Id;
var service = ApplicationContext.Current.Services.ContentService;
var content = service.GetById(id);
if(content.HasProperty("visitCounter")){
if(content.GetValue("visitCounter")==null){
content.SetValue("visitCounter",0);
service.Publish(content);
}
else{
content.SetValue("visitCounter",content.GetValue("visitCounter")+1);
service.Publish(content);
}
}
}
To display the code, use the following logic (example)
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
int visits = int.Parse(Umbraco.Field("visitCounter").ToString());
}
<h1>This is the home</h1>
<strong>Visited: @visits</strong>
To start counting, add the macro to the page you intent do track, (and the property in the document type)
@Umbraco.RenderMacro("VisitCounter")
This is a simple macro, if you have massive traffic, publishing constantly may have side effects. The plan is making a new visit counter that does not publish it to the page, which will be available soon.