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>.
analytics正确设置连接字符串.Sitecore.OMS.Sitecore.xDB.base.Analytics.Enabled应该被设置为true在Sitecore.Analytics.config.Xdb.Enabled和Xdb.Tracking.Enabled应设置true在Sitecore.Xdb.config.<sites>在部分Web.config文件,并检查enableAnalytics是不是设置false上<site name="website">,或者你使用的任何部位.enableTracking被设置true为您的网站在Sitecore.config.Analytics.Robots.IgnoreRobots和Analytics.AutoDetectBots来禁用机器人检测.如果在此之后保存了相互作用,我将使用进一步的说明更新我的答案.false| 归档时间: |
|
| 查看次数: |
2630 次 |
| 最近记录: |