Sitecore 8 Profiling Visitors for Beginners

The first step to deliver Personalisation for Anonymous Visitors of your web site is knowing your Visitors through the pages that they have visited…

Sitecore allow you to Profile your customers interests and behavior through the Profile framework where you can define the Profile Keys, Profile Cards and PatternMatch Cards.

In order to be able to fully benefit from this feature, you need to have XDB & Analytics enabled so that you can fully track your customer behavior.




As you can see, there is not always a clear classification, but often the definition touch multiple dimensions…

Once that you have defined your Profiles, it is time to TAG your content so that you can classify your visitors….



Once that you have defined your Profiles and Tagged your content you can easily identify your Anonymous visitors and start delivering personalized content based on the interest and behavior that you were able to track….

Some example of personalisation rules are reported here…






Sitecore Behavior Personalisation InSession

One of the key selling point of Sitecore 8 compared to the other CMS products is the Personalisation Engine.

The definition of “Behavior Personalisation” should be self Explanatory, providing personalised content based on the behavior of the user….

InSession Personalisation DOES NOT REQUIRE XDB license and MONGODB capabilities. Most of the features are enabled also if you are running Sitecore in CMSONLY mode.

The main advantage of XDB comes from the power of Analytics data and it will give you the ability to personalised based on the historic interactions and behavior (eg. checking if the customer has visited the page within the previous visits to the web site, or if the customer has never triggered a specific goal.)

The way of delivering personalised content within Sitecore is common within the personalisation framework and as you would expect you would need to define within your presentation details your personalisation rules.

Within the personalisation engine there are several way to define visitors behavior:

  • Visit user visit a page, or check the entrypage of the journey


  • Goal / Event /Outcome user trigger a goal -Event -Outcome during the visit


  • Campaigns  user come from a campaign landing page/email or his journey qualify with a campaign


  • Referrals/search keyword user come from a specific website or through a specific keyword




Tracker is not initialized error

Within Sitecore 8.1 and 8.2 you could get easily this “Tracker is not initialized error” even if you are not planning to use analytics but for laziness you have not disabled analytics and/or you left within your layout the VisitorIdentification tag…

The simpler way to get rid of this issue if you are not using Analytics is to remove  Sitecore.Analytics.Tracking.config from your include folder.

In the case you want to use analytics therefore you should check that in Sitecore.Analytics.Tracking.config your hostname property is set to the DNS name that you are using to access to your website….

Track a Goal Hit via Sitecore analytics api

This snippet can be used to hit a goal via code with the sitecore analytics api

//Check that analytics are on...
if (Sitecore.Analytics.Tracker.IsActive && Sitecore.Analytics.Tracker.CurrentPage != null)
  //Get the item goal.
  Item goalItem = Sitecore.Context.Database.GetItem("{xxxxx-xxx-xxx-xxxxx}");
  //Page event wrapper
  PageEventItem goal = new PageEventItem(goalItem);
  //Create the record that needs to  store the goal
   VisitorDataSet.PageEventsRow pageEventsRw = Sitecore.Analytics.Tracker.CurrentPage.Register(goal);
  //this is not mandatory
  pageEventsRw.Data = "custom text";
to associate a goal to a sitecore item and to trigger the goal on the page view of the item, you can check this blog post

Getting Started with Sitecore 7.5 Analytics and MongoDb

As probably most of you have already heard, the more exciting new functionality of Sitecore 7.5 is around the Analytics and MongoDb
In this guide, I will help you in your first configuration of the analytics and MongoDb.

Assuming that you have completed the setup of SC 7.5 and Sitecore is running fine on your machine now it is time of download Mongo from here once that you have installed Mongo, you can decide if you want to run as a service or a standalone application.

If you have decided for the standalone application, now it is time to start it you can run the following from command line

cd C:\Program Files\MongoDB 2.6 Standard\bin
mongod.exe -dbpath C:\MongoData

Now you should see in the command line, the MongoDb status and activity tracking.

Now you can browse your sitecore instance ensuring that the Visitor identification tag is rendered correctly


and that the following code is rendered on the pages

<link href="/layouts/System/VisitorIdentification.aspx" rel="stylesheet" type="text/css" />

Assuming that you are running everything on the default MongoDB Port 27017 this should be in your connection string

<add name="analytics" connectionString="mongodb://localhost/analytics"/>
<add name="" connectionString="mongodb://localhost/tracking_live"/>
<add name="tracking.history" connectionString="mongodb://localhost/tracking_history"/>
<add name="reporting" connectionString="user id=user;password=password;Data Source(local);Database=sc75wizardSitecore_Analytics"/>

Now that you have collected some visitors data you can either run the latest visits report (in engagement Analytics) or use a MongoDbViewer (like Mongo Vue) to see your data in the Analytics – Contacts Table


Associate a visitor to a Contact in Sitecore 7.5 Analytics

This is a very important concept of Sitecore Analytics, basically everytime that you are identifying an user (eg. successful login, or getting the email address for any reason) you need to convert the existing “anonymous” visit to a registered contact, in this way the Analytics will associate the anonymous session analytics data to an identified “contact” data

var tracker = Sitecore.Analytics.Tracker.Current;
var identifier = tracker.Contact.Identifiers;
if (identifier.IdentificationLevel != Sitecore.Analytics.Model.ContactIdentificationLevel.Known)

How to ensure that your analytic are turned on Sitecore

This is a very common questions for Sitecore newbie.

Sitecore does not notify you immediately if something is going wrong with your analytics configuration, and to get analytic working.

I would reccomend the following things to check

1) Check that you have the Analytics connection string in your connectionstring.config and that you can access to the database, if you don’t have the db, just get it from SDN (depending on your sitecore version) and restore it

2) Check that you have analytic dll in the bin of your site

3) check that analytics config are in the include folder

4) check that sc:visitoridentification is in your layout or that the new MVC helper is used:

If all the points listed have been followed and everything is working you can check that your page is emitting the following html:
<link href="/layouts/System/VisitorIdentification.aspx" rel="stylesheet" type="text/css" /> 
and if that’s the case, you can check your analytic database and the usage reports