Gravatar for

Question by rmcclanahan, Oct 12, 2016 3:08 PM

Usage Analytics in a Custom UI

We have implemented a custom UI for Coveo search results in Sitecore and I would like to integrate usage analytics into that UI. Is there any documentation available that could help us do this? I was not able to find anything related to custom implementations.

Gravatar for

Comment by gminero, Oct 12, 2016 3:21 PM

by "integrate usage analytics into that UI." do you mean send custom dimensions/metadata to the analytics module? please specify the coveo for sitecore version you are using

Gravatar for

Comment by rmcclanahan, Oct 12, 2016 4:09 PM

Since we have a custom UI we do not have any integration with Usage Analytics. So I'm looking to integrate the same features that the JS and Sitecore UIs have out of the box into my UI.

1 Reply
Gravatar for

Answer by olamothe, Oct 12, 2016 5:14 PM

So, there is documentation about usage analytics API (swagger documentation) available here :

The one that would be interesting for you would be :

  • POST v15/analytics/click
  • POST v15/analytics/search

Then, for each event, you can see the body that each call expect in your request. An important parameter is the "actionCause", which need to match some specific string if you wish for the reporting in the cloud UI to fit correctly.

These strings are not really documented anywhere, except you can try to extrapolate from the base Coveo UI as to what string you should log for each event :

In this huge map of values, you'll see the "name" property : This should match the actionCause you log in the usage analytics service.

Then, there is also the problem that you need to follow additional logic client side in order to log search and click event properly.

Every time your perform a search, the search API will provide you with a searchUID. This maps to the searchQueryUID that the usage analytics service expects to receive when you log a search event.

You also need to store that searchQueryUID for every click event. This UID will be used to link a given query and a given click, and allow the service to inform you of poorly relevant query, for example (frequent query with not many click).

And this is only what I could think on the top of my head.

I guess the conclusion would be that it's totally possible to reproduce what the Coveo UI does for analytics tracking, but it will be a lot of work, and the majority of the documentation that we have about the Usage analytics service is for a end user perspective that wish to create dashboard and explore the data, or a developer that is already using the Coveo UI.

There is practically 0 documentation available for a developer that wish to reproduce what the Coveo UI does, except the available source code on github.

Gravatar for

Comment by rmcclanahan, Oct 13, 2016 10:59 AM

Thanks for your detailed response. I will work through this and see if we can piece together an integration.

Ask a question