Update: So the issue was that my application Global.asax.cs did not derive from Sitecore.Web.Application.
So I have just installed Sitecore 8 with MongoDB 2.6.11.
For test purposes I placed the code below in page load event to activate the goal I have created earlier in sitecore.
The goal was created successfully via deploy and publish. I have also confirmed the item id of the goal is correct.
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();
Sadly this did not work and I can not see the goal in xDB under Interactions.
Other things I have looked into is that my layout definitely has the tag
<sc:VisitorIdentification runat="server" />
my Global.asax implements Sitecore.Web.Application
public class Global : Sitecore.Web.Application
Yet no luck. The Interactions are no where to be seen in Mongo (using mongo shell and roboMongo to look up the collection). Am I missing something else?
Sitecore Error
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: )
First of all, this is the correct way to trigger a goal:
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);
}
You should not attempt to change the event data after you've registered it.
Also, you should not call Interaction.AcceptModifications()
, as this method is something xDB uses internally at some point.
CurrentPage.Register()
is the only thing that you need to do.
I don't recommend using Session.Abandon()
. It will probably result in saving your interaction to the collection database, but this way you are disrupting the normal flow of Sitecore's session. One of the problems that this may lead to is that the interaction's contact will remain locked for 21 minutes (or whatever your session timeout is set to + 1 minute).
Instead, for testing purposes, I recommend you to set session timeout to 1 minute and just wait for 1 minute after your last page request. This setting is located in the Web.config as an attribute of <sessionState>
.
analytics
connection string is set properly.Sitecore.OMS
.Sitecore.xDB.base
.Analytics.Enabled
should be set to true
in the Sitecore.Analytics.config.Xdb.Enabled
and Xdb.Tracking.Enabled
should be set to true
in the Sitecore.Xdb.config.<sites>
section in the Web.config and check that enableAnalytics
is not set to false
on <site name="website">
or whatever site you are using.enableTracking
is set to true
for your site in the Sitecore.config.Analytics.Robots.IgnoreRobots
and Analytics.AutoDetectBots
to false
in the Sitecore.Analytics.Tracking.config. If interactions are saved after this, I will update my answer with further instructions.