This technical article was first published over 2 years ago and may discuss features and approaches that are no longer relevant for the current version of the platform.

A common usage for advanced website analytics systems (Omniture, Google etc) is to track the effectiveness of external digital marketing campaigns such as banner ads, pay-per-click, sponsored search results.

Technically, this is normally achieved by adding a querystring key to the campaign link url and then tracking requests that use this key. So for example, a Google Adwords campaign linking to your /products page would also include a querystring parameter of cid=marketingcampaign (example: http://yoursite.com/products?cid=marketingcampaign)

This querystring parameter can be picked up by your analytics implementation and used to track various aspects of the campaign.

On an EPiServer CMS6 R2 site, editors can use the Personalization/Visitor Group framework to provide a unique page experience per visitor, meaning that its possible to provide personalized content for each external marketing campaign on any page on your site.

Out-of-the-box, EPiServer provides a criterion which checks the incoming request Url or the page referrer, but not one that checks the querystring of the incoming request.

Creating a Visitor group criterion is straight forward – the only issue I’ve ever had trouble with; is when working on a .NET 4.0 project – which was solved by Ted Nyberg.

I’ve created a simple QueryString Criterion which will provide a match based on the following:

  1. Whether the current request contains a user specified querystring key
  2. and / or whether the current request contains a matching querystring key which also has the user specified value.

Querystring Criterion

The source code is available as part of the Criteria Pack on Codeplex and of course there is a Nuget package on Nuget.episerver.com – (as soon as its been approved!)