Skip to content

Tracks page views for SilverStripe Framework records in a simple counter table

License

Notifications You must be signed in to change notification settings

Webmaxsk/viewcounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple View Counts for SilverStripe records

Build Status

Tracks page views in a simple counter record, and the behaviour is applied to any DataObject subclass through an extension. This approach of a separate counter record is particularly handy if you apply it to Versioned objects like SiteTree, since you can store the view data independently of staging and live concerns.

Views are limited by session. This is a slightly simplistic approach, since it doesn't use other criteria such as the current IP address or browser cookies to prevent abuse. Common web crawlers and search engine bots are excluded from view counts.

Usage

Add the following to your YAML config (e.g. mysite/_config/config.yml):

MyRecordClass:
	extensions:
		- ViewCountableExtension

Views stored in a ViewCount record which relates to your record class. If applying the extension to a SiteTree subclass, views are automatically tracked. For other classes, call trackViewCount() in your own controller init() method.

About

Tracks page views for SilverStripe Framework records in a simple counter table

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published