Search code examples
sitecoresitecore-dms

Sitecore 6.5 DMS - Registering a goal completion via the API


I want to register a goal/conversion on my Sitecore 6.5 site using the API rather than a 'thank-you' page.

I've seen this question about how to do it Sitecore OMS - achieving a goal on a form submission but the answer relates to the API prior to Sitecore 6.5 where it was overhauled quite significantly.

Has anyone done this? Or has this functionality been intentionally removed?


Solution

  • Have you tried something like

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Sitecore.Analytics.Tracker.IsActive && Sitecore.Analytics.Tracker.CurrentPage != null)
        {
            PageEventData eventData = new PageEventData("My Goal Name");
            eventData.Data = "this is some event data.";
            VisitorDataSet.PageEventsRow pageEventsRow = Sitecore.Analytics.Tracker.CurrentPage.Register(eventData);
            Sitecore.Analytics.Tracker.Submit();
        }
    } 
    

    That should register the goal on the currentpage, but not before you decide to in your code