FXM Part 3 – Click Tracking


Of all the FXM features introduced in Sitecore 8 this is by far the coolest. I was skeptical when I saw the button in the Experience Editor to track click events. It seemed there was no way that tracking click events on another site could possibly be done as easily as the interface implied. A little experimentation proved my skepticism unfounded. In truth, it barely warrants a blog post to tell you how to do it, but it is worth a post to show you how easy it is!


So to track a specific click event as with all action in FXM you’ll need to start by setting up a page filter.  If you don’t know how to setup a page filter, see my previous posts here: Intro to FXM.  Once you have the page filter setup, now we add our click event tracking.  From the Experience Editor, click “Capture Click Action” and click on the item you want to track, and then click “Add New Action”.  Similar to how FXM creates placeholder you will then be prompted for an item name and a page filter under which to place the new item.  As before, placement is important as for a given page filter, only the children of the matching page filters will be processed.

Once the click tracking is defined some sort of Marketing action action needs to be associated with it. For our example we’ll associate a goal because it begets an easy test case. So we setup a “Leave Comment” goal and associate it with our click event.

Test Case

So we have all our proverbial ducks lined up, how to we verify that we can knock them over. One of the easiest test is run a personalization scenario based on our goal. To test, first we setup a simple rendering for FXM that we can personalize. For our example, we can use the following View Rendering:

@using Sitecore.Mvc;

<h2> FXM Test Rendering </h2>
<p> @Html.Sitecore().Field(“Text”)

Once we’ve the rendering setup and defined, we can add a placeholder to our page filter. For a quick how-to on placeholders and renderings in FXM you can go here: FXM Part 2 — Content on Non-Sitecore Sites. Add the rendering to our placeholder and we get the following:

To personalize, click on the rendering and click “Create or edit personalization for this component” and setup the following conditions:

Once you have your condition setup, save, and publish your FXM node in Sitecore. Go to your site, click on your tracked button, and marvel in the before and after:

Like what you see? Something I missed? Have an even cooler way to do the same thing?!?! Let me know in the comments below.