我目前正在尝试使用sitecore DMS跟踪sitecore 7.5中的按钮点击,我在互联网上找到了很多信息,但大部分都是在转换到MongoDB之前的7.5之前...
以前它看起来像这样:
//Check that analytics are on...
if (Sitecore.Analytics.Tracker.IsActive && Sitecore.Analytics.Tracker.CurrentPage != null)
{
//Get the item goal.
Item goalItem = Sitecore.Context.Database.GetItem("{xxxxx-xxx-xxx-xxxxx}");
//Page event wrapper
PageEventItem goal = new PageEventItem(goalItem);
//Create the record that needs to store the goal
VisitorDataSet.PageEventsRow pageEventsRw = Sitecore.Analytics.Tracker.CurrentPage.Register(goal);
//this is not mandatory
pageEventsRw.Data = "custom text";
Sitecore.Analytics.Tracker.Submit();
}
我想在Sitecore 7.5中实现这样的目标,但很难在互联网上找到更多的资源,想知道是否有任何高级网站核心用户可以指出我正确的方向?
干杯, MW
答案 0 :(得分:2)
你可以尝试:
if (Sitecore.Analytics.Tracker.IsActive && Sitecore.Analytics.Tracker.Current.CurrentPage != null)
{
Sitecore.Data.Items.Item GoaltoTrigger = Sitecore.Context.Database.GetItem("{Item ID of the Goal}");
if (GoaltoTrigger != null)
{
Sitecore.Analytics.Data.Items.PageEventItem registerthegoal = new Sitecore.Analytics.Data.Items.PageEventItem(GoaltoTrigger);
Sitecore.Analytics.Model.PageEventData eventData = Sitecore.Analytics.Tracker.Current.CurrentPage.Register(registerthegoal);
eventData.Data = GoaltoTrigger["Description"];
Sitecore.Analytics.Tracker.Current.Interaction.AcceptModifications();
}
}