London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Search statistics empty

ZZ
ZZ
Vote:
0

I'm working on Find 15.0.0, CMS 12.23.0

We have a search page on our website that uses unified search -> 

var searchContent = searchClient.UnifiedSearchFor(s)
    .UsingSynonyms()
    .Filter(x => ((IContent)x).Ancestors().Match(parentContentLinkId))
    // Include content which inherits from XX class ie. only pages.
    .Filter(f => f.MatchTypeHierarchy(typeof(BaseClass)))
    //Include content if SearchPublishDate exist 
    .Filter(f => f.SearchPublishDate.Exists())
    //Exclude content if hide from search exist or is set to true
    .Filter(f => (f as BaseClass).HideFromSearch.Match(false))
    //Order by publish date
    .OrderByDescending(o => o.SearchPublishDate)
    .TermsFacetFor(x => x.SearchSection) // Get the facets in the query for the search section of the page
    .Take(100)
    .ApplyBestBets()
    .Track()
    .StaticallyCacheFor(TimeSpan.FromMinutes(10));

When I look in CMS there are no results/data. What could be the reason ?

#315755
Jan 17, 2024 10:43
Vote:
0

The first thing I'd suggest checking would be whether you've included the client-side tracking script as that's required alongside the "track()" call in order to collect the stats. You should see a find.js script added to the output of your page. I'd also suggest cchecking whether you've got a content security policy in place which might block the script loading from dl.episerver.net.

#315759
Jan 17, 2024 13:58
ZZ
Vote:
0

Thanks for your input.

I have now added below line

    @Html.RequiredClientResources(RenderingTags.Footer)

to my _layout.cshtml and after adding this I can now see find.js file 

but still no tracking. 

CSP is not a problem.

We are using vue.js on our website could that be the reason ?

#315810
Jan 18, 2024 12:00
Vote:
0

I have the same problem.  I'm also using Vue. I already had @Html.RequiredClientResources(RenderingTags.Footer) in my layout, and find.js shows in sources.

Yet, nothing appears to be tracked, just as ZZ mentioned.

#315813
Jan 18, 2024 16:22
ZZ
Vote:
0

After containg Optimizely support team, finally I got it fixed.

I had to remove EPiServer.Find.Personalization NuGet package. I also upgraded Find.Cms package to 16.0.0 and now everthing works as expected

Remember following is also need in shared layout. I added it in the bottom of body tag 

    @Html.RequiredClientResources(RenderingTags.Footer)
#316345
Jan 29, 2024 13:14
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.