public ContactData ConvertContactToContactData(Sitecore.Analytics.Tracking.Contact contact) { return(new ContactData() { Identifier = contact.Identifiers.Identifier }); }
private static void SaveNewContactToCollectionDb(Contact contact) { if (!(CreateContactManager() is ContactManager manager)) { return; } contact.ContactSaveMode = ContactSaveMode.AlwaysSave; manager.SaveContactToCollectionDb(Tracker.Current.Contact); }
public Contact GetContact(Sitecore.Analytics.Tracking.Contact currectContact) { var contact = new Contact { //Attachments = currectContact.Attachments, Profiles = currectContact.BehaviorProfiles.Profiles.Select(profile => new ExtraBehaviorProfileContext { Id = profile.Id, NumberOfTimesScored = profile.NumberOfTimesScored, Scores = profile.Scores, PatternId = profile.PatternId, ProfileName = Sitecore.Context.Database.GetItem(profile.Id).Name, PatterneName = (!ID.IsNullOrEmpty(profile.PatternId)) ? Sitecore.Context.Database.GetItem(profile.PatternId).Name : "" }).ToList(), ContactId = currectContact.ContactId, ContactSaveMode = currectContact.ContactSaveMode, Extensions = currectContact.Extensions, Facets = currectContact.Facets, Identifiers = currectContact.Identifiers, IsTemporaryInstance = currectContact.IsTemporaryInstance, System = currectContact.System, Tags = currectContact.Tags }; var items = Tracker.Current.Interaction.Profiles.GetProfileNames(); List <ExtraBehaviorProfileContext> newProfile = (from profileItem in items select Tracker.Current.Interaction.Profiles[profileItem] into profile let scores = profile.ToList() select new ExtraBehaviorProfileContext { PatterneName = profile.PatternLabel, ProfileName = profile.ProfileName, Total = profile.Total, PatternId = profile.PatternId.ToId(), NumberOfTimesScored = profile.Count, StringScore = scores }).ToList(); contact.NewProfiles = newProfile; return(contact); }
public void ShouldSetContactProfile([Frozen] IContactProfileProvider contactProfileProvider, string key, IPhoneNumber phoneNumber, string firstName, string lastName, IContactPersonalInfo personalInfo, Sitecore.Analytics.Tracking.Contact contact) { contactProfileProvider.Contact.Returns(contact); var contactProfileService = new ContactProfileService(contactProfileProvider); contactProfileProvider.PersonalInfo.Returns(personalInfo); var profile = new EditProfile(); profile.FirstName = firstName; profile.LastName = lastName; profile.PhoneNumber = phoneNumber.Number; contactProfileService.SetProfile(profile); contactProfileProvider.PersonalInfo.FirstName.ShouldBeEquivalentTo(profile.FirstName); contactProfileProvider.PersonalInfo.Surname.ShouldBeEquivalentTo(profile.LastName); contactProfileProvider.PhoneNumbers.Entries[contactProfileProvider.PhoneNumbers.Preferred].Number.ShouldBeEquivalentTo(profile.PhoneNumber); }