How to use the trackSiteSearch event?


#1

Hi,

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:

window.snowplow_name_here('trackSiteSearch',
    ['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?

Thanks,
Guillaume


#2

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 atomic.events table. You can link the two tables by means of relation event_id = root_id.

–Ihor


#3

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


#4

@alex - here’s the reference: https://github.com/snowplow/snowplow/wiki/2-Specific-event-tracking-with-the-Javascript-tracker#siteSearch


#5

Thanks @ihor!


#6

Thanks a lot @ihor!