sitecoresitecore6sitecore-dmspersonalization

How to Manage personalization on records in sitecore


Now I am working on sitecore project there is i need to add personalization on records not on sub-layout. E.g My project is reporting based i want to show report give below criteria.

  1. If it's a registered user then reports shows as per Customer interest.(Customer interest added by customer due to registration.)
  2. If it's an anonymous user, the reports show as per customer's country (How can we get client country on anonymous user?)
  3. Get reports from last searched information from cookies and show result.

Please help me above scenario . Thanks in advance.


Solution

  • Personalisation can be achieved in the following way:

    Answer 2 :

    Use Geo IP Lookup Data to gather country information you are after. So Geo IP Lookup Data is provided to Sitecore Engagement Analytics through third party web services. Geo IP data is stored in the Analytics database, so lookups do not have to be performed for returning visitors. Bear in mind that default install comes only with a trial version of the third party web services, so there is a cost involved.

    Engagement Analytics API is primarily used to access Visitor Data using

    Here is how one would access GEO IP Data:

    public class GeoIPTracker : Sitecore.Web.UI.WebControl
    {
        protected override void DoRender(System.Web.UI.HtmlTextWriter output)
        {
            string ip = new IPAddress(Tracker.CurrentVisit.Ip).ToString();
    
            if (Tracker.CurrentVisit == null)
            return;
    
            if (!Tracker.CurrentVisit.UpdateGeoIpData())
                output.Write("GeoIP information not " + "available within prescribed time.<br/>");
            else if (Tracker.CurrentVisit.BusinessName == "IP_NOT_FOUND" || Tracker.CurrentVisit.BusinessName == "N/A")
                output.Write("GeoIP information not avaialble for " + ip + ".<br/>");
            else if (String.IsNullOrEmpty(Tracker.CurrentVisit.BusinessName))
                output.Write("No business name in GeoIP data for " + ip + " (error contacting provider).<br/>");
            else
                output.Write("Business name from GeoIP record: " + Tracker.CurrentVisit.BusinessName + ".<br/>");
        }
    }
    

    Answer 1:

    You can use the data stored in Tracking Fields and get specific information regarding your registered users profile.

    Again Engagement Analytics API's classes like

    Should give you enough data to work with so that Report display can be customised.

    Here is how one would access Profile Data:

    using System.Linq;  
    using Sitecore.Analytics.Data;
    using Sitecore.Data;
    using Sitecore.Data.Fields;
    using Sitecore.Data.Items;
    using Sitecore.Diagnostics;
    
    public class Profile : Sitecore.Web.UI.WebControl
    {
        protected override void DoRender(System.Web.UI.HtmlTextWriter output)
        {
            Item homeItem = Sitecore.Data.Database.GetDatabase("master").GetItem("/sitecore/content/Home");
            Field innerField = homeItem.Fields["__Tracking"];
    
            if (innerField == null)
            {
                Log.Error(string.Format("Tracking field was not found in item '{0}' ('{1}')", homeItem.ID, homeItem.Paths.FullPath), this);
                output.WriteLine("No profile values.<br/>");
            }
            else
            {
                TrackingField trackingField = new TrackingField(innerField);
                ContentProfile profile = trackingField.Profiles.FirstOrDefault(profileData => profileData.Name.Equals("Score") && profileData.IsSavedInField);
                output.WriteLine("Profile " + profile.Name + "<br/>");
                ContentProfileKeyData[] profileKeys = profile.Keys;
    
                foreach (ContentProfileKeyData profileKey in profileKeys)
                {
                    output.WriteLine("Profile key name " + profileKey.Name + "<br/>");
                    output.WriteLine("Profile key value " + profileKey.Value + "<br/>");
                }
            }
        }
    }
    

    Let me know if this was helpful or not.

    Vital information can be found in Engagement Analytics API Cookbook on the SDN