xDB不存储任何交互

Bob*_*bby 3 sitecore mongodb sitecore8 sitecore-xdb

更新:问题是我的应用程序Global.asax.cs并非源自Sitecore.Web.Application.

所以我刚刚使用MongoDB 2.6.11安装了Sitecore 8.

出于测试目的,我将下面的代码放在页面加载事件中,以激活我之前在sitecore中创建的目标.

目标是通过部署和发布成功创建的.我还确认了目标的项目ID是正确的.

    if (Sitecore.Analytics.Tracker.IsActive && Sitecore.Analytics.Tracker.Current.CurrentPage != null)
    {
       Sitecore.Data.Items.Item GoaltoTrigger = Sitecore.Context.Database.GetItem("{EDA8EA2C-7AF5-4D0F-AF76-A9C4E6BD7169}");
       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();
       }
    }
    Session.Abandon();
Run Code Online (Sandbox Code Playgroud)

遗憾的是,这不起作用,我无法在交互下的xDB中看到目标.

我调查的其他事情是我的布局肯定有标签

<sc:VisitorIdentification runat="server" />
Run Code Online (Sandbox Code Playgroud)

我的Global.asax实现了Sitecore.Web.Application

public class Global : Sitecore.Web.Application
Run Code Online (Sandbox Code Playgroud)

但没有运气.在Mongo中无法看到交互(使用mongo shell和roboMongo来查找集合).我错过了别的什么吗?

在此输入图像描述

在此输入图像描述

Sitecore错误

ManagedPoolThread #3 16:43:00 INFO  Job ended: Sitecore.ListManagement.Analytics.UnlockContactListsAgent (units processed: )
12980 16:43:05 INFO  Cache created: '[no name]' (max size: 976KB, running total: 2918MB)
12980 16:43:05 INFO  Cache created: '[no name]' (max size: 976KB, running total: 2919MB)
12980 16:43:05 INFO  Cache created: '[no name]' (max size: 976KB, running total: 2920MB)
12980 16:43:05 INFO  Cache created: '[no name]' (max size: 976KB, running total: 2921MB)
12980 16:43:05 INFO  Cache created: '[no name]' (max size: 976KB, running total: 2922MB)
ManagedPoolThread #5 16:43:06 ERROR Failed to perform MaxMind lookup
ManagedPoolThread #5 16:43:06 ERROR Failed to perform GeoIp lookup for 127.0.0.1
Exception: Sitecore.Analytics.Lookups.CannotParseResponseException
Message: Unexpected format. Cannot parse the MaxMind response for IP address: 127.0.0.1

Source: Sitecore.Analytics
   at Sitecore.Analytics.Lookups.MaxMindProvider.GetInformationByIp(String ip)
   at Sitecore.Analytics.Lookups.GeoIpManager.GetDataFromLookupProvider(GeoIpHandle geoIpHandle)

12980 16:43:08 INFO  Cache created: 'WebUtil.QueryStringCache' (max size: 19KB, running total: 2922MB)
2700 16:43:08 INFO  HttpModule is being initialized
12360 16:43:08 INFO  HttpModule is being initialized
7068 16:43:08 INFO  HttpModule is being initialized
9940 16:43:10 INFO  [Experience Analytics]: Reduce agent found zero segments to process
ManagedPoolThread #1 16:43:10 INFO  Job started: Sitecore.ListManagement.Analytics.UnlockContactListsAgent
ManagedPoolThread #1 16:43:10 INFO  Job ended: Sitecore.ListManagement.Analytics.UnlockContactListsAgent (units processed: )
Run Code Online (Sandbox Code Playgroud)

Dmy*_*nko 11

触发目标

首先,这是触发目标的正确方法:

if (Sitecore.Analytics.Tracker.IsActive)
{
    if (Sitecore.Analytics.Tracker.Current.CurrentPage != null)
    {
        var goalId = new Sitecore.Data.ID("{EDA8EA2C-7AF5-4D0F-AF76-A9C4E6BD7169}");

        Sitecore.Analytics.Data.Items.PageEventItem goalToTrigger =
            Sitecore.Analytics.Tracker.DefinitionItems.PageEvents[goalId];

        if (goalToTrigger != null)
        {
            Sitecore.Analytics.Model.PageEventData eventData =
                Sitecore.Analytics.Tracker.Current.CurrentPage.Register(goalToTrigger);
        }
        else
        {
            Sitecore.Diagnostics.Log.Error("Goal with ID " + goalId + " does not exist", this);
        }
    }
    else
    {
        Sitecore.Diagnostics.Log.Error("Tracker.Current.CurrentPage is null", this);
    }
}
else
{
    Sitecore.Diagnostics.Log.Warn("The tracker is not active. Unable to register the goal.", this);
}
Run Code Online (Sandbox Code Playgroud)

注册后,不应尝试更改事件数据.

此外,您不应该调用Interaction.AcceptModifications(),因为此方法是xDB在某些时候内部使用的方法.

CurrentPage.Register() 是你唯一需要做的事情.

结束会议

我不建议使用Session.Abandon().它可能会导致您将交互保存到集合数据库,但这样就会破坏Sitecore会话的正常流程.这可能导致的一个问题是交互的联系人将保持锁定21分钟(或者无论您的会话超时设置为+ 1分钟).

相反,出于测试目的,我建议您将会话超时设置为1分钟,并在最后一页请求后等待1分钟.此设置位于Web.config中作为属性<sessionState>.

排除交互保存问题

  1. 确保analytics正确设置连接字符串.
  2. 确保您拥有xDB许可证.您可以在Sitecore控制面板 - >管理 - >已安装的许可证中查看可用许可证列表.
    a)在Sitecore 8.0或更低版本中,许可证名称为Sitecore.OMS.
    b)在Sitecore 8.1中Sitecore.xDB.base.
  3. 确保已启用xDB及其跟踪子系统.
    一)在Sitecore的8.0或更低,Analytics.Enabled应该被设置为trueSitecore.Analytics.config.
    二)在Sitecore的8.1,这两个Xdb.EnabledXdb.Tracking.Enabled应设置trueSitecore.Xdb.config.
  4. 还应在网站定义上启用跟踪.
    一)在Sitecore的8.0或更低,到<sites>在部分Web.config文件,并检查enableAnalytics不是设置false<site name="website">,或者你使用的任何部位.
    B)在Sitecore的8.1,你应该确保enableTracking被设置true为您的网站在Sitecore.config.
  5. 在让会话过期之前尝试制作多个页面请求而不是一个.
  6. 尝试通过在Sitecore.Analytics.Tracking.config中设置Analytics.Robots.IgnoreRobotsAnalytics.AutoDetectBots来禁用机器人检测.如果在此之后保存了相互作用,我将使用进一步的说明更新我的答案.false
  7. 如果没有任何帮助,请完成文章疑难解答xDB数据问题中列出的步骤.