Track search phrases when using unified search?



Is it possible to track search phrases (most common/without hits) when using unified search? If so, can anyone provide some dummy code on how to achieve this?

Note that I don't want to track clicks or anything, just the search phrases. I tried enabling click tracking but ended up with this ugly URL which I don't want to expose to the end user.

We're using EPiServer CMS along with EPiServer Find


Edited, Jul 02, 2018 8:28

Hi Markus Andersson,

May be this helps

public static string TrackQuery(string query, int noOfHits = 1)
            var id = new TrackContext().Id;
            SearchClient.Instance.Statistics().TrackQuery(query, x =>
                x.Id = id;
                x.Tags = GetTags();
                x.Query.Hits = noOfHits;

            return id;
Jul 03, 2018 3:04


And thank you! It worked the way I expected.

However, I find it weird that you have to do this manually when using Unified Search.

Jul 03, 2018 11:32

Glad it helped.

Just one thing GetTags() function is just this line 

Jul 04, 2018 4:59
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.