Associate a visitor to a Contact in Sitecore 7.5 Analytics

This is a very important concept of Sitecore Analytics, basically everytime that you are identifying an user (eg. successful login, or getting the email address for any reason) you need to convert the existing “anonymous” visit to a registered contact, in this way the Analytics will associate the anonymous session analytics data to an identified “contact” data

var tracker = Sitecore.Analytics.Tracker.Current;
var identifier = tracker.Contact.Identifiers;
if (identifier.IdentificationLevel != Sitecore.Analytics.Model.ContactIdentificationLevel.Known)
{
   tracker.Session.Identify("stelio@thisIsMyEmail.com");
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s