SaaS CMS has officially launched! Learn more now.



Before I used a trackscript (new Tracking().TrackingScriptUrl) to do the tracking, now Im using the track() funcition (serverside) when i execute the search. I got 2 problems with the new way of doing things:

  1. Since I do the tracking serverside, the server ip is tracked instead of the client ip. Any solution for this?
  2. When I look at the statistics I get a this search word "*" as best search/Beste søk. I also get other normal search words in the best search but "*" is ranked first. Why is that?
Feb 27, 2013 11:53

Regarding #2, could you post the code for your search request where this occurs?

Feb 27, 2013 12:17


Regarding #1 the ip tracked is as follows:
if the request contains the HTTP_X_FORWARDED_FOR it will use that value else it will fallback to the HttpContext.Current.Request.UserHostAddress.

It will never look at the server ip so I'm a little suspicious how it shows up in the statistics. If you intercept your trackingrequest in fiddler  (path: YOURINDEX/_track) what is the ip-parameter that is passed? 


Feb 27, 2013 12:29

Regarding #2, I assume you're tracking searches without any query, e.g. a list page.

That's easy fixed with an if-statement.

if (!string.IsNullOrWhiteSpace(yourQuery))
    query = query.Track();


Feb 27, 2013 13:53
This is what I do:

 = SearchClient.Instance.Search<ISearchablePage>(Language.Norwegian)                 .For(Query)                 .InField(x => x.PageHeader)                 .AndInField(x => x.PageName)                 .AndInField(x => x.MainIntro)                 .AndInField(x => x.BodyText)                 .TermsFacetFor(x => x.Categories)                 //.StaticallyCacheFor(TimeSpan.FromMinutes(30))                 .Filter(catFilter)                 //.Filter(x => x.PageHeader.Fuzzy(Query))                 .Select(x => new SearchHit()                 {                     Title = x.PageHeader ?? x.PageName,                     Text = FirstNotEmpty(                         x.MainIntro.AsHighlighted(new HighlightSpec() { FragmentSize = 300NumberOfFragments = 1PreTag = "<strong>"PostTag = "</strong>" }),                         x.MainIntro.AsCropped(300),                         x.BodyText.AsHighlighted(new HighlightSpec { FragmentSize = 300NumberOfFragments = 1PreTag = "<strong>"PostTag = "</strong>" }),                         x.BodyText.AsCropped(300)                     ),                     Url = x.LinkURL,                     Categories = x.Categories                 })                 .Take(pagingControl.PageSize)                 .Skip((pagingControl.ActivePageNumber - 1) * pagingControl.PageSize)                 .Track()                 .GetResult();
Feb 27, 2013 16:01
* 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.