How To Get Started With Sitecore 8 xDB

how to get started with Sitecore 8 xDB

For Marketers, Sitecore 8 XP offers a powerful full-fledged, completely integrated and easy-to-use marketing solution to deliver a consistent experience throughout all channels. There are connectors and interfaces available to interact with a variety of common tools, like CRMs or Social Media plattforms.

Many Sitecore developers however seem to avoid getting involved too heavily with the Sitecore DMS or the xDB, respectively. I cannot really tell you why, but for some reason I was one of them too. Since it is pretty obvious that this aspect of Sitecore is getting more important in every release, I finally took the time to check out all the features and how they are presented in Sitecore 8.

This blog post at a glance


We show you how to get started with Sitecore 8 xDB. Take a look at how to create and assign profiles and profile cards, set up goals, campaigns and personalize content.

Empowering you to get more out of Sitecore with a simple setup. This way you already get more than basic tracking of customer behavior, audience groups, and campaign evaluation.


You should consider upgrading if you are using the marketing functionalities heavily or need any of the new features (e.g. versioned layouts).

Plus if  you are using a version earlier than Sitecore 7.1. It is always helpful not to fall too far behind the upgrade cycle since it complicates future upgrades

Microsoft Azure

If you do not have a virtual machine you can set one up in Microsoft Azure. I did this mainly because I wanted to try out the database-as-a-service feature. There are a few pitfalls here when setting up the Sitecore databases though.

For example, you cannot use MDF/LDF files to create a new database, you need to extract the data to a BACPAC file. For the most databases this is not a problem, but the Session Database cannot be completely exported since it has external references. This can be fixed by removing the CreateTables stored procedure (should not be used anyway) or removing the conditions accessing the schema.

More on Azure and Sitecore will be discussed in a blog post in the future.


I assume that you have MongoDB installed, set up as service, and running (you can find a tutorial here), as well as a freshly installed Sitecore 8 instance and Visual Studio for the development.

When developing for Sitecore, you typically trigger application restarts regularly which is quite a time-consuming process in Sitecore. A lot of this time is spent precompiling the SPEAK-Views, so I suggest deactivating it while developing. There is also a more complete blog post about Maximizing Sitecore Development Productivity available by John West.

Adding Language Detection

Sitecore Language Detection based ont the client browsers is so popular you may wonder why this is not a default Sitecore feature by now. Luckily the enhancement is going to be a cake run when using John’s or Mark’s LanguageResolver: Include the file in your Visual Studio project, deploy the assembly in the bin folder and register the processor in the web.config after the ItemResolver.
<processor type="Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel"/>
<processor type="Sitecore.Sharedsource.Pipelines.HttpRequestBegin.LanguageResolver, <MyAssembly>"/>

Analytics Preparation & Setup

Before you generate some artificial traffic to track on your site, you need to set up analytics. If you are not familiar with the whole concept, the Marketing Operations Cookbook is a great starting point. The 120 pages may scare you but I found it much easier to read than expected.

For testing purposes I suggest you add or edit the following settings in Sitecore.Analytics.Tracking.config:

<!-- Visitors do not have to browse through multiple pages to get a pattern card assigned -->
<setting name= "Analytics.Patterns.MinimalProfileScoreCount" value= "1" />

Now open the Sitecore client and start the Marketing Control panel. Navigate to profiles to see some predefined items. You can use these or create your own profiles if you want, just make sure you create a pattern card for any profile (here is why). I deleted the original profiles and created my own, ending up with the following setup.


Short recap

  1. Profile Cards are means to classify your content, they are assigned to items to describe their information
  2. Pattern Cards are means to classify your visitors depending on the information they view

The Authoring Selection (determines whether multiple profile cards can be added to an item) is somewhat hidden. To change it, select the Profile Cards item and switch to the content view.


Make sure to publish all changes.

Creating and Profiling Content

It is time to generate some content. You can also go with the one single home item that ships with Sitecore but the statistics won’t look too impressive if you do. I created a two-level hierarchy with two languages as my test site.


Next you should add profile cards to your content. To do so, open a content item and click the small icon in the upper right corner. You should see a list of your profiles. Next, click Edit and add your profile cards (The dialog looks different depending on your Authoring Selection).



If you confirm, the profiles are shown besides the profile editing button and in the profile card window. Since my Authoring Selection is Multiple, I can add more than one profile and the weighting is always uniformly distributed.


Note that you can always customize the profile key values, which essentially means you ignore the predefined profile cards. To ensure consistency throughout your page you should avoid using customized values, though.

Flushing Data into the xDB

To flush your user data into the xDB, you would have to wait for the session to time out. Although you can reduce this timeout setting in your web.config, it might still come in handy to flush on demand. Luckily it is as easy as creating a rendering with a Flush-button that calls Session.Abandon() and adding it to your layouts.

Tracking Traffic

Now you can start surfing the site. Try to emulate different behavioral patterns by navigating to pages with specific pattern cards and also try different languages. Clear your cookies or use different browsers when you want to simulate new contacts.

After waiting for a few moments your data should have entered the reporting database. You should be able to see your visitor statistics, e.g. in the language overview or the pattern matches dashboard.



Setting up Goals

Next I wanted to define and assign goals. For the purpose of this demo, my goal is to make the customer download a case study brochure. Naturally we start in the marketing control panel and insert a new item in the goals section (you don’t need to change any values). Save and Deploy the item (goals are in a workflow), then publish.



Now we can assign our goal to items. In our case, we enter the media library and select the brochure. Then we open the Goals in the Analyze Ribbon and check the new goal, in our case Brochure Download.


Save and publish.

You will note that there also is a Download Brochure goal as well, but this is a predefined page event. You can choose if you want to track both.

Go to the frontend and download the brochure. Depending on your setup you need some preparation to make the brochure available. The easiest way is probably to use a rich text field and add an internal link.

After the reporting database has been updated you should see your goal in the Goals Dashboard of the experience analytics.


You can see that I also assigned and triggered the Download Brochure event at some point.

Creating Campaigns

Let us also create a campaign to track incoming traffic. Again we start in the Marketing Control Panel and create a campaign item under Campaigns. Sitecore will automatically fill the Campaign Link Field for us.


Campaigns are in a workflow, so deploy before publishing. Once published, our campaign is active (unless you entered a start and end date) and is tracking data. You can trigger your campaign by accessing the page with the given query string (e.g. http://<YourSite>?sc_camp=2C9784566AC74E478665CF1A22BA16C4). If you also want to try out your campaign link under more realistic conditions I suggest that you take a look at txti. You can also generate external referrers in this case.

Once your data is in the reporting database, your analytics should show data. If you use txti, you can also find new referrals.



Personalization of Content

To try out the personalization functionality, we utilize our previously defined goal. For our scenario, let us create a simple sublayout with a message that only appears if the customer downloaded a brochure.


Then we change the rendering in the standard value of our item template to use our new sublayout. Once the sublayout is assigned, click on Personalize, New Condition, then enter a name and click Edit.


Type goal into the search box and select the rule where the specific goal was triggered during the current visit.


Select our goal by clicking on the specific link, then select the one we defined earlier, Brochure Download.


Click OK and check hide component on the default rendering. The dialogue should now summarize the personalization.


Read: Show the rendering when the current user has downloaded a brochure, otherwise hide.

Once you published everything (do not forget to publish the sublayout as well) we can test our personalization by opening the page. As you probably suspected, we do not yet see our Feedback since we have not yet downloaded a brochure.


Download the brochure and reload this page. The content of the rendering appears.


Where to go from here

We have seen the basic means to get your Analytics running in Sitecore XP 8. With a simple setup like this, you already get more than basic tracking of customer behavior, audience groups, and campaign evaluation.

Subsequent actions include identifying customers (e.g. when they fill out a form or log in), so that your analytics sessions can be merged correctly. Additionally you can enrich your contacts with useful CRM information like phone numbers etc. Check out the great Blog Series One Month with Sitecore 7.5 by Nick Wesselman. From my experience the examples apply to Sitecore 8 pretty well.

How To Get Started With Sitecore 8 xDB
Article Name
How To Get Started With Sitecore 8 xDB
To get the most out of Sitecore 8 you should leverage its xDB component. Learn how to get started.
Publisher Name
Atos Consulting CH
Publisher Logo

Leave a Reply

Your email address will not be published. Required fields are marked *