Question

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

  • User1@email.com and attached asp session id
  • User2@email.com and attached asp session id
  • User3@email.com and attached asp session id

Now lets say User1@email.com 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?

Was it helpful?

Solution 2

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.

OTHER TIPS

The information you are looking for is not stored against a (ASP.Net membership) user per say - it is Stored against a (Sitecore DMS) visitor.

Here is one way to interrogate the current visitors profile data:

var visit = Tracker.CurrentVisit;
foreach (var profile in visit.Profiles)
{
    if (profile.ProfileName.ToLower() == "interest")
    {
        // Look at individual values
        var values = VisitProfile.Parse(profile.PatternValues);
        var motorcycles = values["motorcycles"];

        // Look at pattern matched
        profile.UpdatePattern();
        var matchingPattern = profile.PatternLabel;
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top