Gravatar for

Question by Dean, May 17, 2017 6:03 AM

Click Tracking not picking the correct URL


We are trying to implement click tracking in our search results in Coveo for Sitecore and we were able to log the clicks in Analytics just by adding the "CoveoResultLink" class to the anchor. A search result item will have the link to the actual item plus additional links to documents and other support pages related to that particular result. The problem is, for other links inside the same search result item, Coveo doesn't pick up and log the correct "href" value for the other links and it seem to pick just one URL even for the document and the other links.

Attached is a sample of our template.

In the Analytics site, the document link click is showing the click to the LFrelativeURL instead of the SeriesDatasheetUrl


Gravatar for

Comment by Sébastien Belzile, May 17, 2017 10:23 AM

What is your Coveo for Sitecore version?

1 Reply
Gravatar for

Answer by Sébastien Belzile, May 18, 2017 11:03 AM

It took me a while to actually setup myself to test this, which I actually did not do.

I found the issue on our side. It is a bug in your specific version. I has been fixed 2 years ago in JS UI 1.0, but the fix has not been back ported to JS UI 0.9.

Workaround that you could apply:

  • Code your own ResultLink component: copy the actual result link and fix it yourself. Here is the TypeScript code of the fix that is in the JS repository:

private logOpenDocument() {
    var documentURL = $(this.element).attr('href');
    if(documentURL == undefined || documentURL == '') {
        documentURL = this.result.clickUri;
    this.usageAnalytics.logClickEvent<AnalyticsDocumentViewMeta>(AnalyticsActionCauseList.documentOpen, {
        documentURL: documentURL,
        documentTitle: this.result.title
    }, this.result, this.root);
  • Otherwise, Coveo support could probably help you.

You should also consider an upgrade to Coveo for Sitecore 4.0, which ships with JS UI 1.0. JS UI 0.9 is only in "maintenance" right now, and if you look at the code of the JS UI, you should see that a version 2.0 is on the way.

Gravatar for

Comment by Dean, May 22, 2017 4:51 AM

I'll try it out, and get back to you, Thanks

Ask a question