Sitecore Click-stream Analytics

Personalized contents are everywhere now. In order to drive more sales or show the best contents to users, marketers define strategies on to allow users to be exposed to contents or offers which are meant for them. I had a requirement where I had to track the user content flow on one of our sites.

The requirement was very simple; When a user arrives on the site, we need to track every click and view he/she performs on the site along with goals. To be able to achieve this, I have use the Sitecore Page Events. In this article, I will be explaining how you can achieve the click-stream.


  1. Create a category for the content click event in Sitecore.
  2. Add a checkbox whether a content should have its click event tracked.
  3. Implementation of a method to register the Page Event in MongoDB.
  4. Implementation of an aggregation processor to take data from MongoDB to SQL Reporting Database.

The first thing is to create a Sitecore checkbox field type on the template called Track Performance. The functionality of this field is whether you want to track the click on this content. For example, you may want to track content A but not a static page such as about us page.


Create a Page Event Category under the path /sitecore/system/Settings/Analytics/Page Events. Example, you can named it Content Events Click. You need to implement a handler for the item:saved so that if the Track Performance is checked, then the handler will need to create an item at the path /sitecore/system/Settings/Analytics/Page Events/Content Events Click. Below is the code snippet of the ItemSavedEventHanlder.

When items are saved, it will create a Page Event item. Please see below screenshot.


Now, when user navigates on the site and performs clicks, you need to perform a call to a method which will register the click event into MongoDB. The code snippet is provided below.

From the above code, you will see that I am checking if the clicked item has its id in the Content Event Click container. If it is not present, the click will not be registered in MongoDB.

Once the data has been captured in MongoDB, you will need to implement an aggregator which will aggregates the data from MongoDB to the Sitecore Reporting Database. You can read more from my blog post on How to setup the Sitecore Aggregation.


  • You will need to have a custom table to add those data.
  • Implement a dashboard or page on the Sitecore Experience Analytics Page to read the data.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s