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.

  • DougS's avatar
    DougS
    Khoros Oracle

    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

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

    • fleonyleon's avatar
      fleonyleon
      Guide

      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

        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