Is there any button click event in Sitecore Tracker in version 9.1

342 views Asked by At

I am looking for a personalization event that have to occur when a click event takes place.

1

There are 1 answers

0
Kate Orlova On

No, there is not and you have to track your button click event on the server side in Sitecore.

Add an onclick() JavaScript event to your button to make the server call and pass details about the clicked button. Then register the click event as a Goal on the server side.

You can create a Goal and then trigger it as a pre-built Sitecore event using the Sitecore.Analytics.Tracker.Current.CurrentPage.RegisterGoal() method to register your Goal against the current page as follows:

var goalId = "{Your Goal ID}"; // ID of your goal
var goalDefinition = Sitecore.Analytics.Tracker.MarketingDefinitions.Goals[goalId];
Sitecore.Analytics.Tracker.Current.CurrentPage.RegisterGoal(goalDefinition);

Read more about the pre-built events in Sitecore here.