在Sitecore中获取个人页面的个人资料关键得分 [英] Get Profile Key Score for Individual Page in Sitecore

查看:70
本文介绍了在Sitecore中获取个人页面的个人资料关键得分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a question regarding Sitecore Analytics and user profile keys. I need to be able to get the score of a profile key for an individual page. For example, if I have a profile key called "traveler" that could have a value of 1-10 on a given page, I need to be able to get the value for that key that was assigned by the content author. I have found that by using the following:

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

我可以获得用户在整个会话中积累的总得分,但是我似乎找不到一种仅针对当前页面获得得分的方法.

I can get the total score that the user has accumulated throughout their session, but I cannot seem to find a way to get the score just for the current page.

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

Any insight anyone could offer would be greatly appreciated. Thanks.

推荐答案

我知道这篇文章比较老,但是为了将来参考,Sitecore发生了很多变化. 我不知道2010年是否有可能,但是至少在2013年,有API方法可以提取页面的跟踪值.

I know this post is rather old, but for future references a lot has changed in Sitecore. I do not know if this was possible in 2010, but at least in 2013 there are API methods for extracting the Tracking values of a page.

我永远不建议手动解析__Tracking字段中的原始数据.

I would never recommend to manually parse the raw data in in the __Tracking Field.

以下是使用Sitecore Analytics API读取Persona个人资料的跟踪数据的方法:

Here's how to read tracking data for the Persona Profile using the 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();
    }

最好的问候 拉瑟·拉施(Lasse Rasch)

Best Regards Lasse Rasch

这篇关于在Sitecore中获取个人页面的个人资料关键得分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆