2

I have a Sitecore component which displays news headlines and "readmore" link. Once the user clicks on "read more", it shows extra information on the same page.

How can I track all the users who clicked on that link?

Should I explicitly write some code to this ? If not, where can I see the data?

Note:

  • Sitecore version 8.2
  • Mongo DB (Analytics) is enabled
  • Is your link a Sitecore link or a custom <a href=.... link? – Chris Auer Sep 5 '18 at 2:02
  • It is a custom link – user3621 Sep 6 '18 at 15:02
5

I would use Page Event rather than Goal in this case as it is more appropriate. There is not much technical difference between those two.

1) Creating Page Event

You can create Page Event under /sitecore/system/Settings/Analytics/Page Events.

enter image description here

and then fire it programmatically:

private void RegisterPageEvent(string name, Guid definitionId, Guid itemId, string data, string text)

{

  Assert.IsNotNull(Tracker.Current, "Tracker.Current");

  Assert.IsNotNull(Tracker.Current.Session, "Tracker.Current.Session");

  var interaction = Tracker.Current.Session.Interaction;

  Assert.IsNotNull(interaction, "Tracker.Current.Session.Interaction");

  Assert.IsNotNull(interaction.CurrentPage, "Tracker.Current.Session.Interaction.CurrentPage");

  var pageEventData = new PageEventData(name, definitionId)

  {

    ItemId = itemId,

    Data = data,

    Text = text

  };

  interaction.CurrentPage.Register(pageEventData);

}

You can follow these guidelines for further clarification:

2) Analytics You have various options how to get list of visitors who triggered that page event. Just to name some:

a) Engagement plan - You can create engagement plan with initial condition "where your page event was triggered". Follow this official documentation. Then you can monitor this engagement plan to get list of visitors who clicked on that button and you can also supervise this engagement plan.

b) Custom Experience Analytics Report -> Follow official documentation.

Conclusion: This part depends on what should be outcome for you. Just count of clicks is sufficient? or you need more details about visitors who clicked for further processing? Both these requirements can be achieved with option a).

You can also configure page event to appear in Experience profile.

2

As the requirement to show extra information on the same page, it would be hard to trigger an serverside event. My suggestion would be the following:

  • configure FXM for your Sitecore site, which enables you to track events/goals using javascript (see documentation)
  • register an event or goal (as Peter proposed) for the "readmore" action
  • onclick, fire the javascript to trigger this goal
  • use the default Experience ANalytics report for goals (if you used a goal) to track the number of clicks, or create a custom report for this specific event.
  • The Path analyzer could be used as well, for analyzing clicks, clickthroughs et cetera

when including FXM on your localwebsite, you could use the following code to track an event or goal:

SCBeacon.trackEvent(“Read more”) SCBeacon.trackEvent(“Read more”, { data: “custom data”, dataKey: “custom data key” })

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.