Search code examples
sitecoresitecore-dms

Viewing Sitecore DMS profile key values for individual visitors


It's a really simple question really, but I can't seem to find an answer neither here or on SDN.

How do I view the profile values stored for users that has visited the site?

To elaborate by example: Lets say I have 3 visitors, visiting the site, and they have all at some point clicked a newsletter item and thus their email has been paired with their asp session id, so I'd have something like

Now lets say [email protected] has his/her main interest in motorcycles, and I have a set of profile keys, consisting of cars, motorcycles and bikes. User1 mostly clicks around on the motorcycles pages and therefore that key for this user has a higher value.

Somewhere I should be able to see that users data, with their stored value (example data: cars 10, motorcycles 250, bikes 40).

Where can I see that data? Or is this completely impossible?


Solution

  • I solved it myself. I should probably mention that it is to be used for a customized newsletter.

    First I get the internal sitecore username attached to the mailing list.

    var username = System.Web.Security.Membership.GetUserNameByEmail(email);
    

    Then I can get a visitor ID from the username.

    var visitor = Sitecore.Analytics.Automation.VisitorManager.GetVisitorByExternalUser(username);
    

    And in this visitor the dataset with the profile keys I'm looking for is located in visitor.DataSet.Profiles

    Now I just need to get more than one visitor but its just a matter of doing an SQL call instead of using VisitorManager.GetVisitorByExternalUser and finding all occurences.