3

現在、サブレイアウトではなくレコードにパーソナライゼーションを追加する必要があるサイトコア プロジェクトに取り組んでいます。たとえば、私のプロジェクトはレポートに基づいています。以下の基準でレポートを表示したいと考えています。

  1. 登録済みユーザーの場合、顧客の関心ごとにレポートが表示されます (顧客の関心は、登録により顧客によって追加されました)。
  2. 匿名ユーザーの場合、レポートは顧客の国ごとに表示されます (匿名ユーザーでクライアントの国を取得するにはどうすればよいですか?)
  3. Cookie から最後に検索された情報からレポートを取得し、結果を表示します。

上記のシナリオを手伝ってください。前もって感謝します。

4

1 に答える 1

3

パーソナライゼーションは、次の方法で実現できます。

答え 2 :

Geo IP ルックアップ データを使用して、目的の国の情報を収集します。そのため、地域 IP ルックアップ データは、サード パーティの Web サービスを通じて Sitecore Engagement Analytics に提供されます。Geo IP データは Analytics データベースに保存されるため、再訪問者に対してルックアップを実行する必要はありません。デフォルトのインストールには、サード パーティの Web サービスの試用版しか付属していないため、費用がかかることに注意してください。

Engagement Analytics API は主に、次を使用して訪問者データにアクセスするために使用されます。

  • Sitecore.Analytics.Tracker
  • Sitecore.Analytics.TrackerDataContext

GEO IP データにアクセスする方法は次のとおりです。

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/>");
    }
}

答え 1:

トラッキング フィールドに保存されたデータを使用して、登録済みユーザー プロファイルに関する特定の情報を取得できます。

再び Engagement Analytics API のクラス

  • Sitecore.Analytics.Data.TrackingField
  • Sitecore.Analytics.Data.ContentProfile
  • Sitecore.Analytics.Data.ContentProfileKeyData

レポート表示をカスタマイズできるように、作業するのに十分なデータを提供する必要があります。

プロファイル データにアクセスする方法は次のとおりです。

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/>");
            }
        }
    }
}

これが役に立ったかどうか教えてください。

重要な情報は、 SDNのEngagement Analytics API Cookbookにあります。

于 2013-10-17T13:54:27.370 に答える