-
-
Save islaytitans/eab737aefa03dd334167cabe0f89c2fc to your computer and use it in GitHub Desktop.
Controller to receive data and register Sitecore goals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jonathan- Can you please tell me which dll holds this class -PageEventRequestResult