Optimizely Archive

Injecting Fragments in Optimizely XHtmlStrings

Injecting fragments in Optimizely XHtmlStrings is quite easy using a custom display template to render the property. Here is an example on how you can inject custom data based on Optimizely blocks dropped in the XHtmlString property. I’ve been using an approach similar to this to inject ids used for anchor tag navigation also within free text. The interesting thing in the custom display template …

Clearing output cache in a multi server environment

This is a follow up to the previous Acting on Optimizely Remote Events article. While still working with the older Optimizely 11 you may rely on the Remote Event functionality to clear cache. However, in some cases you may need to build on this functionality to clear the output cache on other servers manually. In a previous project we used this to clear the cache …

Prevent certain Optimizely visitor groups from being used in content areas

At my current client we had the need to prevent the use of certain visitor groups in some of the content areas. I.e. some areas were only to support national content, and other areas only regional content (where each region had a different visitor group). Here is a solution making use of ValidationAttribute. The visitor group ids are kept in the ContentAreaItem’s AllowedRoles property. The …

System.Data.SqlClient.SqlException: Invalid column name ‘IsApproved’, ‘IsLockedOut’, ‘Comment’, ‘CreationDate’, ‘LastLoginDate’, ‘LastLockoutDate’

Got this SqlException again moving a database from a client’s production environment into development. Thought I’d write a short note on resolving it. Check the migration history table: It is likely that the initial create of the tables used Microsoft.AspNet.Identity.EntityFramework.IdentityUser instead of the expected EPiServer.Cms.UI.AspNetIdentity.ApplicationUser. The ContextKey column would contain EPiServer.Cms.UI.AspNetIdentity.ApplicationDbContext`1 rather than EPiServer.Cms.UI.AspNetIdentity.ApplicationDbContext`1 . This may be resolved by removing the tables dbo.__MigrationHistory …

Acting on Optimizely Remote Events

Just a short piece on how to act on Optimizely‘s remote events. While in later versions you may use for instance RabbitMQ or ActiveMQ, still being on 11 will have you using the older event distribution. For attaching your own handlers to the received event, you will need to get an instance of the IEventProviderAccessor rather than accessing events directly like with publish events via …

Using ActiveMQ with Optimizely 12

Whilst setting up Optimizely 12 to work with RabbitMQ is rather straight forward, making it use ActiveMQ for transport instead requires a bit more configuration on our part. Here is a short article on how to set up Optimizely 12 to use MassTransit (EPiServer.Events.MassTransit) with ActiveMQ. For a short instruction on how to set up a local ActiveMQ server, please see Muthu Kumaran‘s article on …

ActiveMQ connection tester application

While moving our client’s Optimizely 12 website to a new hosting provider we had to abandon our RabbitMQ installation in favour of a new ActiveMQ one, also supported by the on-prem event provider (EPiServer.Events.MassTransit). To make it easier setting this up I rewrote the old RabbitMQ connection tester application into a new one working with ActiveMQ. Source code and executable are available at GitHub. To …

Episerver Remote Events tester console application for framework 4.8 and Optimizely 11

My current client is moving their Optimizely 11 websites to a new hosting provider and we need an easy way to test the remote event replication system. I remember that there was an old console application for this back in the day, but when I found a copy of it I realized that it required .net 2.0 to function. I shamelessly disassembled the application and …

RabbitMQ connection tester application

We set up Optimizely‘s new on-prem event provider (EPiServer.Events.MassTransit) for my current client’s Optimizely 12 website the other week. At current date it is still in beta until there are enough uses for there to be a production release. For the mass transit we set up RabbitMQ. For earlier Optimizely (Episerver) versions built on ASP.NET Framework there was a tool for testing the event replication …

Simple way to use enums for sorting in Optimizely Search & Navigation

As stated in the Optimizely Search & Navigation developer documentation on Sorting, “Sorting is supported for numerical types such as int, double, DateTime, and string”. This means that you will get an error from EPiServer.Find.SortingValidationHelper.ValidateSupportedType if you attempt to sort on an enum field. There are of course various solutions to this problem, but here is a rather simple one: turn the enum into a string …

Finding the latest Optimizely Search & Navigation’s client Javascript URL

I got a question on how to find the latest version of the Search & Navigation /epi-util/find.js script file after publishing the article Proxy for Optimizely Search & Navigation tracking script. It is really quite simple, if you look at how Optimiezely does things. The solution is to make use of the built-in IPathHelper (namespace EPiServer.Find.UI.Helpers). Optimizely’s default GetClientResourceBasePath implementation essentially makes a request to …

Proxy for Optimizely Search & Navigation tracking script

When using Optimizely Search & Navigation (previously Episerver Find) you will automatically get a reference to a client side Javascript injected into your markup. Occationally, you may want to proxy it via your Optimizely website’s backend, caching it or just make it appear as if it comes from your own domain. It may also be a way of avoiding false positives in regards to script …