sitecore - 获取 Sitecore 中单个页面的个人资料关键分数

标签 sitecore analytics sitecore-dms

我对 Sitecore Analytics 和用户个人资料 key 有疑问。我需要能够获取单个页面的配置文件 key 的分数。例如,如果我有一个名为“traveler”的个人资料键,该键在给定页面上的值为 1-10,那么我需要能够获取内容作者分配的该键的值。我发现通过使用以下内容:

Sitecore.Analytics.AnalyticsTracker.Current.Data.Profiles.GetProfile("Profile Name").GetProfileKeyValue("traveler")

我可以获得用户在整个 session 中累积的总分,但我似乎找不到一种方法来获取当前页面的分数。

任何人都可以提供的任何见解将不胜感激。谢谢。

最佳答案

我知道这篇文章相当旧,但为了将来的引用,Sitecore 中发生了很多变化。 我不知道这在 2010 年是否可行,但至少在 2013 年有 API 方法可以提取页面的 Tracking 值。

我绝不会建议手动解析 __Tracking 字段中的原始数据。

以下是如何使用 Sitecore Analytics API 读取角色配置文件的跟踪数据:

public static string ProfileValues(this Item item)
{
        StringBuilder sb = new StringBuilder();

        TrackingField trackingField = new TrackingField(item.Fields[Constants.Sitecore.FieldIDs.Tracking]);
        ContentProfile profile = trackingField.Profiles.FirstOrDefault(profileData =>
                                profileData.Name.Equals("Persona") && profileData.IsSavedInField);

        ContentProfileKeyData[] profileKeys = profile.Keys;

        foreach (ContentProfileKeyData profileKey in profileKeys)
        {
            sb.AppendLine(string.Format("{0}:{1};", profileKey.Name, profileKey.Value));
        }
        return sb.ToString();
    }

致以诚挚的问候 拉塞·拉什

关于sitecore - 获取 Sitecore 中单个页面的个人资料关键分数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3943186/

相关文章:

Sitecore 找不到路径 "{E18F4BC6-46A2-4842-898B-B6613733F06F}"

Sitecore 个性化 - 根据访客资料更改子布局参数

azure - Azure 中的 Sitecore DMS

Sitecore 7.2 MVC 和 DMS

c# - Sitecore 8 MVC ajax调用路由寄存器

Sitecore包上传错误

c# - 为什么 Sitecore 从 C# API 发布草稿项目,我该如何阻止它这样做?

google-analytics - 如何在 SO 上的问答中添加实时分析?

azure - Azure Data Lake 中的文件夹统计信息