Gravatar for wvuong@captechconsulting.com

Question by wvuong, Jun 4, 2016 11:35 AM

Coveo not tracking when a search result is selected?

I'm trying to confirm that our Coveo Analytics is tracking when a user selects a result, but I don't think this is currently happening. I thought this was happening automatically. Is there something I need to enable for this to happen, or how can I confirm that it is happening. When looking at the "Search Relevance (Documents)" report, there are no results for the last month.

We are using Coveo for Sitecore 4 Cloud Edition.

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Jun 4, 2016 4:44 PM

Hi,

The "document click" is one of the events Coveo analytics log. I do not have my computer with me to confirm or not that it does work, but here is what you can do to test it:

  1. Open your developer tools (F12).
  2. Select the network tab.
  3. Click on a document.

Before being sent on another page, you should see a call being performed to the C4SC proxy (/coveo/rest/usageanalytics(?)/click).

If this goes too fast (redirection…), you can place a break point in the file CoveoForSitecore.js in the event changeAnalyticsCustomData. That way, you should see the data being sent to Coveo Analytics. The line looks like the following.

$(this).on(Coveo.AnalyticsEvents.ChangeAnalyticsCustomData, function(e, args) {
    if (something) { // Breakpoint here

I will confirm if it does work OOTB on monday.

Gravatar for wvuong@captechconsulting.com

Comment by wvuong, Jun 4, 2016 10:00 PM

I put a breakpoint on that callback. It is not hit when I select a result.

Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Jun 6, 2016 8:04 AM

Are you logged in / using the experience editor? Coveo Analytics are disabled for the master DB so that development does not affect your Analytics data.

Usually, viewing your page in private mode should do.

-> Ensure the analytics component is being rendered on the page (a div that looks like this: <div class="CoveoAnalytics").

-> If it does not work, maybe your Analytics component is not properly configured. Could you share the corresponding HTML element with us? (located in the file CoveoSearch.ascx or the cshtml equivalent)

Gravatar for wvuong@captechconsulting.com

Comment by wvuong, Jun 6, 2016 9:13 AM

I confirmed viewing the page from the live site does not hit that method still.

Here is the CoveoAnalytics div on the page.

class="CoveoAnalytics" data-anonymous="True" data-endpoint="/coveo/rest/coveoanalytics" data-search-hub="Find-a-Doctor" data-send-to-cloud="True"

Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Jun 6, 2016 9:43 AM

Do other events hit the break point? Are they logged in Coveo UA?

Gravatar for wvuong@captechconsulting.com

Comment by wvuong, Jun 6, 2016 11:55 AM

Doing a search and selecting facets hit the break point and are logged in UA

Gravatar for sbelzile@coveo.com

Comment by Sébastien Belzile, Jun 6, 2016 12:38 PM

I think I found what is wrong:

The OOTB document title is defined as follow in the .ascx file:

<a class='CoveoResultLink'>{{=title?highlight(title, titleHighlights):clickUri}}</a>

Did you modify it?

Does your "a" tag has class "CoveoResultLink"?

There is another call to clickUri on the OOTB page. This one is defined like this:

<a href="{{= clickUri}}">{{= clickUri}}</a>

If I click on it, it does not log to UA. We will fix that on our side. Add the class on your "a" tags and it should work fine.

Gravatar for wvuong@captechconsulting.com

Comment by wvuong, Jun 6, 2016 12:51 PM

Yeah, none of our search results currently have the CoveoResultLink class, I will add that in and get back to you.

Thanks.

Gravatar for wvuong@captechconsulting.com

Comment by wvuong, Jun 6, 2016 4:58 PM

This was it, Thanks.

Ask a question