Posts tagged "component tracking"

May 19, 2012

How to track CQ component clicks in SiteCatalyst

When SiteCatalyst’s tracking is enabled on a site, the overall site traffic and page-to-page traffic tracking is pretty much given and administrators usually do not have to do anything. But one of the requirements that most companies desire is the component tracking capability – to be able to tell which component on a page the users are coming from. Here’s a typical scenario:

  • A featured article is displayed inside a Slideshow or teaser type component on a page, e.g. http://www.example.com/home.html.
  • The same featured article is displayed inside another component (e.g. Spotlight component) on the same page – http://www.example.com/home.html

Requirement:

  • To be able to track traffic at component level.

In order to do this, two SiteCatalyst variables will need to be introduced:

  • A variable on tracking what components are “clicked from”. In this example I named the variable “Clicked From Component”.
  • A variable on tracking what pages the components lead to, or “clicked to”. In this example I named the variable “Clicked To Page”.

And it is critical to set up a correlation between these two variables:

On to CQ:

On the CQ side, components will need to be customized to pass the variables onto the “clicked to” page so traffic can be tracked. For instance, links can be modified to have additional parameters like the following:

http://server:port/news/2012/5/component-tracking-example.html?trackFrom=Spotlight

And on pages that should be tracked, the following code can be inserted to surface the variables inside CQ’s clickstreamcloud:

if (request.getParameter("trackFrom") != null) {
        String trackFromComponent = (String) request.getParameter("trackFrom");
        %>
        <span record="'trackComponent',{'clickedFrom':'<%=trackFromComponent%>','clickedTo':'<%=request.getRequestURL()%>'}"></span>
        <%
}

 

Then these parameters will be surfaced inside CQ’s clickstreamcloud:

To map these events to SiteCatalyst variables, (after traffic variables setup in SiteCatalyst), simply Edit the clickstreamcloud and map the following events to variables:

  • clickedFrom – “Clicked From Component”
  • clickedTo – “Clicked To Page”

 

 

Once all the above is done, you may click around and start viewing the “Clicked From Component” report in SiteCatalyst. And to view how components are “clicked to” certain pages, the correlation report surface that very nicely.

Clicked From Component Report

 

Correlation Report

2:21 PM Permalink