Forum Discussion

fleonyleon's avatar
6 years ago

Custom Search Component not being captured by Analytics

We have created a custom search component for similar reasons: better design, and it is working perfectly.

The problem we now have is that the searches are not being captured by Analytics, so the LSI report on number of searches shows zero.

One of the objectives of the custom component was to make it more user friendly and increase searches and now we don't have a way to measure it.

We were told by Support to include the following query parameter to API call for them to be captured by Analytics:

api.for_ui_search=true

Problem is the change was done yesterday and we still don't see the results of quantity of searches in Analytics.

Any advise you can give us? There is no documentation on this parameter that we can use as a reference so we might be using it incorrectly...or maybe we just need to wait for Analytics a while longer?

  • Are you using a LiQL query with a MATCHES clause or REST V1 search calls to do your custom search? I believe the api.for_ui_search=true parameter only works for LiQL queries (not for the REST V1 search endpoints). If you are using a LiQL query with a MATCHES clause and you don't start seeing search terms start to show up (from the date you added it forward), I would recommend filing a support case b/c it should start working.

    -Doug

  • DougS's avatar
    DougS
    6 years ago

    That looks correct. I would advise you file a support case at this point if you are not seeing the search terms showing up in LSI.

9 Replies

  • DougS's avatar
    DougS
    Khoros Oracle
    6 years ago

    Are you using a LiQL query with a MATCHES clause or REST V1 search calls to do your custom search? I believe the api.for_ui_search=true parameter only works for LiQL queries (not for the REST V1 search endpoints). If you are using a LiQL query with a MATCHES clause and you don't start seeing search terms start to show up (from the date you added it forward), I would recommend filing a support case b/c it should start working.

    -Doug

  • fleonyleon's avatar
    fleonyleon
    Guide
    6 years ago

    Thanks for your comments! We will validate with our development team.

  • fleonyleon's avatar
    fleonyleon
    Guide
    6 years ago

    We validated we are using LiQL query with matches but from your link we realized we were not including the search=true parameter correctly.

    We changed it following the example from the link but we are now getting an error message, so we are still not doing it correctly. 

    CDB15C74-95F6-4EC4-B4E7-E1907C8CC0CC.png

    Can you guide as to documentation where we can review how we should use the search=true parameter in our code?

    Thanks,

    Federico

  • DougS's avatar
    DougS
    Khoros Oracle
    6 years ago

    You need to include it as a separate query parameter to the URI that you pass into the rest freemarker call -- for example:

     

     

    <#assign liql = "SELECT id, view_href, subject, search_snippet, body, depth, author.view_href, author.id, author.login, author.avatar.profile, author.rank, author.online_status, post_time, post_time_friendly, board.id, board.view_href, board.short_title, conversation.solved, conversation.last_post_time, conversation.last_post_time_friendly, conversation.last_post.author.view_href, conversation.last_post.author.login, conversation.last_post.author.id, conversation.last_post.author.rank, conversation.style, labels, replies.count(*), metrics.views, kudos.sum(weight), ratings.avg(value) FROM messages WHERE depth = 0 AND board.id != 'Articulos' AND subject MATCHES 'test' OR body MATCHES 'test'" />
    
    <#assign resp = rest("2.0", "/search?api.for_ui_search=true&q=" + liql?url) />

     

     

     

    Looks like there is an issue with the example onhttps://developer.khoros.com/khoroscommunitydevdocs/docs/using-liql. That example should be this:

     

    <#assign x= rest("2.0","/search?q=" + "SELECT * FROM messages WHERE body MATCHES 'wireless' OR subject MATCHES 'wireless'"?url + "&api.for_ui_search=true") />

     

    I've clicked on "suggest edits" on that page and suggested this example be changed. Looks like the example has already been fixed there! Sorry for the confusion this caused you.

    Hopefully this helps you get this resolved.

    Thanks,

    -Doug

  • fleonyleon's avatar
    fleonyleon
    Guide
    6 years ago

    Thanks for your recommendation! We made the changes yesterday and we are not getting the error anymore... we pushed the changes into production. 

    Problem is that we still don’t see the search count results in Analytics. Should it show today or do we need to wait until Monday?

    Regards,

    Federico

  • fleonyleon's avatar
    fleonyleon
    Guide
    6 years ago

    Hello, 

    We tried today again and we still can't see the search results in Analytics.

    This is how we changed the code according to your last recommendation, I hope our development team did them correctly.
    Captura de Pantalla 2019-06-03 a la(s) 10.16.15.png

    Please validate we understood correctly the changes that needed to be made and any other suggestions you may have.

    Thanks!

    Federico

  • DougS's avatar
    DougS
    Khoros Oracle
    6 years ago

    That looks correct. I would advise you file a support case at this point if you are not seeing the search terms showing up in LSI.

  • fleonyleon's avatar
    fleonyleon
    Guide
    6 years ago

    Doug hi,

    Hope you are doing fine. Khoros updated our community's software so that the API calls for search start working again. They have tested with a direct API call and the search results do show now on LSI, but the search results from our component, as described and validated by you above, are still not being captured by LSI.

    We changed the component on stage so that the command shows up as a COMMENT and this is what we got:

    Can you please help us validating that the command is being sent correctly, including the search=true part for data capture by LSI?

    Thanks!

    Federico