Gravatar for ashwin.kc@xero.com

Question by ashwin.kc@xero.com, May 23, 2018 4:48 AM

Coveo logClickEvent is not working in Custom ui

Hi

We have implemented custom UI to show most popular topics in our Lightning community.I need to register an custom event when user clicks on Topic in Popular Topic component.I am able to register event in Coveo using - logCustomEvent, but we want to register an event using logClickEvent. When I use logClickEvent all events are going - incoherent event section and with error code - CLICK_WITHOUT_ASSOCIATED_SEARCH.

I have looked into documentation and found out this error is due to incorrect search query uid.

I like to know

1. How do I fetch "query UID"

2.How do I attach query UID with logClickEvent.

Thanks in advance

Gravatar for flguillemette@coveo.com

Comment by François Lachance-Guillemette, May 23, 2018 1:42 PM

I would suggest that you have a look at how the `CoveoResultLink` component works.

This is how the framework handles click in the Result Templates, so you can see how it extracts the properties to send them in the Usage Analytics.

See here: ResultLink - logClickEvent section

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, May 23, 2018 1:46 PM

Every time a search is performed, you are going to see a "searchUid" returned by the API.

You need to set this as the "searchQueryUid" property on the click event that you send to the usage analytics API, for this given query.

This ID will be different for each query performed.

Gravatar for ashwin.kc@xero.com

Comment by ashwin.kc@xero.com, May 24, 2018 1:55 AM

Hi @olamothe

Thanks for your reply.

I am able to fetch SearchUI from Search response,I am using

coveo('logClickEvent',eventCause,{},result);

`result` has all information related to selected Topic and set it up data for `eventCause`.

My concern is can I use above method to register click event or I need to use - POST method (https://docs.coveo.com/en/18/cloud-v2-api-reference/usage-analytics-write-api)

Looking forward to hear from you

Gravatar for ashwin.kc@xero.com

Comment by ashwin.kc@xero.com, May 31, 2018 4:15 AM

Hi @olamothe

Thanks for your reply.

We are using standard Coveo UI, only difference we are not using coveo result template instead of that we have custom one.

So I can use logClickEvent method to fire Coveo click event.

Ask a question