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.
So, there is documentation about usage analytics API (swagger documentation) available here : https://usageanalytics.coveo.com/docs/
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 : https://github.com/coveo/search-ui/blob/master/src/ui/Analytics/AnalyticsActionListMeta.ts#L171
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.