Configuring contact recognition

Most current sites need to deal with contact recognition scenarios involving visitors with the same IP addresses. Visitors often come from shared networks, such as company or municipal networks. Kentico's contact recognition is configured so that it best covers these scenarios. This means that Kentico doesn't automatically assign contacts to anonymous visitors based on their:

  • Browser user agent
  • IP addresses

The system also remembers contacts until their cookies are deleted or until a different contact is determined for the visitor.

If this behavior doesn't suit your needs, you can change it programmatically by implementing the Kentico's ICurrentContactProvider interface:

  1. Create a class that implements the ICurrentContactProvider interface.
  2. Implement your own logic for contact recognition.

    using System;
    
    using CMS;
    using CMS.Membership;
    using CMS.ContactManagement;
    
    [assembly: RegisterImplementation(typeof(ICurrentContactProvider), typeof(CustomCurrentContactProvider))]
    /// <summary>
    /// Summary description for CustomCurrentContactProvider
    /// </summary>
    public class CustomCurrentContactProvider : ICurrentContactProvider
    {
        public ContactInfo GetCurrentContact(IUserInfo currentUser, bool forceUserMatching)
        {
    		// Implement your contact recognition logic
            throw new NotImplementedException();
        }
    	
    	public ContactInfo GetExistingContact(IUserInfo currentUser, bool forceUserMatching)
    	{
    		// Implement your contact recognition logic
    		throw new NotImplementedException();
    	}
    
        public void SetCurrentContact(ContactInfo contact)
        {
    		// Implement your logic for storing information about the current contact
            throw new NotImplementedException();
        }
    }
  3. Save the file.

Kentico EMS required

Features described on this page require the Kentico EMS license.


Was this page helpful?