Try our conversational search powered by Generative AI!

Dan Matthews
Mar 20, 2013
  3260
(1 votes)

EPiServer 7 and Live Monitor

Many of you have probably used the funky Live Monitor with EPiServer CMS 6 (otherwise known as EPiServer Trace). If you come to deploy it in EPiServer 7 and you are creating your own site using the web site template rather than starting with the Alloy templates, you may have a little difficulty in getting it running. It spins up, but no visits are ever tracked. Why is this? Well, Live Monitor works by injecting some tracking javascript into the page which, in turn, calls a handler URL to record the ‘visit’. To inject that tracking code, you need to use a new EPiServer feature called ‘Required Client Resources’. In the Alloy templates, this is done for you. However, if you started from scratch with the EPiServer web site template, you won’t have this and will need to add it yourself.

To get it all working, take a look at the following article on the SDK:

Live Monitor Configuration in EPiServer 7 (SDK)

Annoyingly, if you followed the instructions in the documentation on World rather than the SDK, then you’re probably tying yourself in knots and not getting anywhere – it’s not updated yet. If you’re interested in the background…

In EPiServer 6, getting that tracking javascript code injected could be troublesome because it requires EPiServer to be able to intercept, parse and modify the pages coming through. In an ideal world, the tracking code should be automatically inserted by EPiServer hooks that are added when you deploy Live Monitor. However, this often didn’t work because of the parsing requirements. The workaround was therefore to insert the tracking code manually by adding an ASP.NET control to the page called ‘VisitTracker’. Indeed, this is what the CMS 7 documentation on World currently tells you to do:

Live Monitor Configuration in EPiServer 7 (World) - DO NOT USE THIS!

Unfortunately, if you try and do this in EPiServer 7 then you’ll soon find out that ‘VisitTracker’ no longer exists (resulting in various missing tag prefix errors at runtime). The reason for this is that because EPiServer 7 uses this new Required Client Resources technique, there is now a much better way to inject the needed tracker javascript and it doesn’t have anything to do with manually adding controls.

Simply put, this new technique will scan all assemblies for classes that are marked with an attribute for required client resources, then it will call the classes to generate the resources (it’s an interface it calls) and insert the resulting resource references at a defined point on the page. Where these resources are inserted depends on an ASP.NET control called, unsuprisingly, ‘RequiredClientResources’. In Alloy, this is pre-set up for you in Root.Master:

<EPiServer:RequiredClientResources RenderingArea="Header" ID="RequiredResourcesHeader" runat="server" />

The solution is very simple then – simply include the RequiredClientResources controls where needed. You should add two… one in the Header and one in the Footer. The link at the top of this article will take you from here.

Mar 20, 2013

Comments

Please login to comment.
Latest blogs
Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog

The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024