How to use the trackSiteSearch event?



I want to implement trackSiteSearch to track terms entered by users on my website.
I added the basic script in my header page just to check if some data was tracked:

    ['unified', 'log'], // search terms
    ['books'],          // filters
    14,                 // results found
    8,                  // results displayed on first page

I couldn’t find any of the data in my events table, so I was thinking that maybe I need add some enrichment to be able to track search terms?

If yes, which one and how can I add it?



Hi @gtd,

The site_search event is implemented as unstructured (self-describing) event. As such the associated data would have to be loaded into the dedicated table, specifically com_snowplowanalytics_snowplow_site_search_1. The definition for the table could be found here in case you haven’t created the table yet.

This also means that this event would be labeled as unstruct in the event field of the table. You can link the two tables by means of relation event_id = root_id.



On a side note @gtd - where did you see the trackSiteSearch command in our documentation? I don’t believe it should exist…


@alex - here’s the reference:


Thanks @ihor!


Thanks a lot @ihor!