We’ve migrated our documentation to a new site, which means some URLs have changed.
Audience

"Tagging" recs clicks for Piano Insight

In Insight, page views resulting from content recommendation clicks have the custom parameter cx_source=cxrecs.
Similarly, you can add your own custom parameters as query parameters to the click URL.

Here is an example where this is used together with "itemDefaults" to distinguish between clicks from different branches
(similar to tag paths in the Content applications)


image-20211217-131106.png


<!--%
var items = data.response.items;
for (var i = 0; i < items.length; i++) {
  var item = items[i];
  var itemsrc = item.src || 'generic'; # get the injected item key/value or set a default
  var tagged_click_url = item.click_url + '?cx_tag=' + itemsrc; # add it as a custom parameter to the click_url
  %-->
  <div class="item">
    <!-- use the tagged_click_url instead of item.click_url -->
    <a class="allclick" tmp:id="{{cX.clickTracker(tagged_click_url)}}" tmp:href="{{item.url}}" tmp:target="_top">
      <!--%
      cX.renderContainedImage({
        container: { width: 321, height: 160 },
        image: { src: item.dominantthumbnail, dimensions: item.dominantthumbnaildimensions }
      });
      %-->
      <h3>{{item.title}}</h3>
    </a>
  </div>
  <!--%
}
%-->


Last updated: