Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Controller to receive data and register Sitecore goals
public class PageEventController : Controller
{
[System.Web.Mvc.HttpPost]
public JsonResult RegisterGoal(string goalId, string goalDescription)
{
Item eventItem = Sitecore.Context.Database.GetItem(goalId);
var goal = new PageEventItem(eventItem);
if (!Tracker.IsActive)
Tracker.StartTracking();
Sitecore.Analytics.Model.PageEventData eventData = Tracker.Current.CurrentPage.Register(goal);
eventData.Data = goal["Description"] + " " + goalDescription;
Tracker.Current.Interaction.AcceptModifications();
return Json(new PageEventRequestResult()
{
Success = true,
Message = "Successfully registered goal",
});
}
}
@abhaydhar

This comment has been minimized.

Copy link

@abhaydhar abhaydhar commented Jul 1, 2016

Jonathan- Can you please tell me which dll holds this class -PageEventRequestResult

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment