2

I am using sitecore profile cards in the. Is there a way to fetch the current persona of the user that is mapped. I am using sitecore 6.6

Martin Davies
  • 4,436
  • 3
  • 19
  • 40
Selwyn
  • 1,621
  • 6
  • 21
  • 38

1 Answers1

2

You can use the Analytics api to do this:

 var visit = Tracker.CurrentVisit;
 foreach (var profile in visit.Profiles)
 {  
   if (profile.ProfileName.ToLower() == "persona")
   {
      profile.UpdatePattern();

       // get the matching pattern text
      var matchingPattern = profile.PatternLabel;
   }
 }
Ian Graham
  • 3,206
  • 1
  • 15
  • 23
  • *Can this answer be updated*? It looks like Tracker.CurrentVisit is obsolete. Whether I use Tracker.Current.Interaction or Tracker.CurrentVisit, when I try to iterate through visit.Profiles, the compiler says: `foreach statement cannot operate on variables of type 'IVisitProfiles' because 'IVisitProfiles' does not contain a public definition for 'GetEnumerator'`. – Paul Oct 26 '17 at 17:13