Monday, 27 June 2016

Sitecore Visitors Profiles - Part 2


Hey everyone, welcome to the second part of Sitecore visitors profiles posts; in the previous part I show you how to define profiles, profile keys and profile cards. So maybe now you wonder in which item field these information saved and how it is saved in database like data structure, so let’s dive and see where and how sitecore do this.


Which field contains these information?

First thing you need to know that these information is saved in a field called “__tracking” as you can see from the following screen shot:


In what format this data saved?

If you dive deep more and check how this field content is saved in database, go to view tab and check Raw Value checkbox and go to field “__Tracking” where you can see the data is saved in xml format as you can see from following: 




So how we can programmatically read this field?

I can think of two ways for doing this, first way is to work on the field content manually and the second way is to work on this field using Sitecore API:

First Way:

As we already saw that field content is in xml format; so we can load this content into xml document and manipulate this content as you can see from the following code:




Second Way:

We can use Sitecore.Analytices.dll to read the tracking field using the following code:



You are free to use any of the above two ways but using Sitecore API is always recommended! Hope the above will help!

 

No comments:

Post a Comment