Real Time Personalization in Optimizely CMS with ODP

Daniel Copping
9 min readAug 9, 2023

--

In this article I’ll explain how you can use the Optimizely Content Cloud (aka CMS) together with the Optimizely Data Platform (ODP) to achieve real time personalization in your website.

I’ll demonstrate how ODP allows you to do this out of the box with product and customer information. I’ll also show you how this can be achieved when your site is not e-commerce driven and you want to personalize based on your visitors’ interest in your content, rather than your products.

Personalization built in

Personalization in Optimizely CMS is delivered by way of Visitor Groups. This is a means to group visitors who meet certain criteria. With this, it is possible to group visitors who, for example, have visited the site a certain number of times, been referred by Google, accessed the site on an Android device or have passed a campaign query parameter in the URL.

For a full list of the built in Visitor Group criteria options in CMS check out this support article here. Note, it is also possible to code your own custom criteria.

Once your visitor groups have been created you can start to personalize your content. To do this, you create custom blocks and markup to target your Visitor Groups specifically and you fallback to default content when the current visitor is not a match for any of them.

This functionality is available in a standard Optimizely CMS install and does not require ODP. However, by using ODP, the criteria available to our Visitor Groups expands to the wealth of data and insights that platform holds on your visitors. This may include data from channels other than your website such as mobile, CRM or social.

To enable this, you need to link your CMS Visitor Groups to ODP Real Time Segments. You can achieve this by following the steps below.

Install the ODP Visitor Groups package

I mentioned that ODP supports personalization in CMS out of the box. This is mostly true, but it does require the installation of one additional Nuget package, ODP.Visitor groups, available here.

Once installed and configured, this package will allow you to create Visitor Groups based on criteria derived from the ODP. Note the new ‘Data platform’ options available in the Visitor Groups UI (see image below).

Setting a Data platform criteria in the CMS Visitor Groups UI

As you can see, CMS admins have the ability to associate their Visitor Groups with data that ODP holds about the customer.

Note, you may prefer to implement your own integration with ODP. Under the hood, this package is simply sending various queries to the ODP’s GraphQL API.

Create a Real Time Segment

Perhaps the most powerful option this integration supports is the ability to link CMS Visitor Groups to ODP Real Time Segments (RTS). Segments in ODP are a similar concept to Visitor Groups in that they also group visitors (referred to as customers) by a set of criteria.

The ‘Real Time’ in the name Real Time Segments relates to the amount of time it takes for them to update. In RTS, Optimizely have engineered a streaming and on-demand approach to segmentation where there is no refresh interval. In effect, RTS are updated with reduced latency where data freshness is realised in less than 90 seconds. When used in a personalization strategy, this allows you to learn and respond to the visitor as they interact with the site in real time.

Note, RTS are different from normal ‘Segments’ (a similar concept in ODP). Unlike normal Segments, Real Time Segments only look back across 28 days of data. This reduced data-set allows RTS to respond with virtually no refresh interval. Normal segments, on the other hand, can take upwards of 15 mins to reflect the true state of the audience. This means they are not suitable for real time personalization and cannot be linked back to CMS Visitor Groups. Further note, Segments and Real Time Segments are managed under different areas of the ODP.

In the ODP UI, RTS are managed under the ‘Customers’ tab.

Here customers can be grouped by any of the various touch points in ODP such as customer attributes (country, name, gender etc), AI driven customer insights (order likelihood, engagement rank, probability still a customer etc) and customer observations (computed age, total revenue, session count, first product, last product etc).

Editing attribute RTS in ODP
Previewing attribute RTS in ODP

In the above example I am grouping visitors (1) who’s address country is Australia or New Zealand, (2) is greater than 18 years old, (3) is considered to be ‘likely’ to purchase and (4) who’s total revenue is greater than $20.

It is also possible to group customers by event conditions such as pageviews, logins and custom events. We can further target visitors who have triggered these events a given number of times and within a given timeframe as per below.

Editing event RTS in ODP
Previewing event RTS in ODP

In the above example, I am grouping visitors who have viewed a page on my site at least 3 times in the last 5 days and who have also clicked on an image gallery in the same amount of time.

Create a Visitor Group

Once we have the integration between CMS and ODP up and running we can use our RTS as the basis for Visitor Groups, and personalization.

In Optimizely Content Cloud (CMS), Visitor Groups are managed under the ‘Audiences’ tab.

Select ‘Create Visitor Group’ and enter values for the name and notes.

Add your criteria, selecting Data platform -> Is In Segment

You should now be able to view and select from available RTS in ODP.

Select the relevant RTS and save the form by clicking on ‘Create Visitor Group’ button. With this, your Visitor Group is created.

You now have a Visitor Group linked to a segment in ODP that can be used for personalizing your content.

Personalize your content

Optimizely CMS allows you to personalize content that is rendered inside content areas or rich text editors.

In the following screenshot, I have created an ‘Article Banner Block’ for the ‘Header Content Area’ of my page and tied it to the ‘ODP RTS Group’. When someone matches this segment in the ODP they will be served this content, while everyone else will see the default.

Personalized content inside a content area

For a more detailed guide on setting up content personalization with Visitor Groups in CMS, see the Optimizely guide here.

Personalization without e-commerce

What if my site is not e-commerce? What if I have no customers or products but I still want to create personalized experiences for the visitors of my site based on their interest in my content.

Take the following example, I’m an editor/marketer on a news site and I want to personalize the homepage to users that have an interest in certain topics, e.g. current affairs, finance, sport etc. I don’t have any products per se. How can ODP help me target these visitors and show them the most relevant content?

It’s certainly possible to target these visitors with the help of ODP but it’s not going to work out of the box. We will first need to let ODP know that our content exists.

Custom Page Object

To achieve this, you need to create a custom object in ODP. This will hold all the meta-data from the page that is relevant to your personalization strategy (e.g, category, tags, page name, author, URL, publish date etc).

Creating the ‘Content Cloud Page’ object
The created ‘Content Cloud Page’ object

Sync CMS Pages to ODP Custom Page Objects

Once you have created a custom page object, you can start to create instances by posting to ODP’s REST API (see the docs here). With this you can sync all your content pages from the CMS to the ODP.

When mapping the object’s ID field in ODP, use the value from your page’s Content Reference GUID. This way you will have a unique value that can link events captured in ODP back to the page.

If you want to keep your ODP content objects up-to-date as your CMS content changes, you have couple of options. One, create an event handler that listens to the publish event and immediately posts the content to ODP. Two, create an scheduled job that syncs all content that has been published since the last successful run.

Link your Custom Objects to Events

The next step is to define a relationship between your events and your pages (a.k.a. Custom Objects). To do this, create a new field on the Events object using the same Field Name as your custom object (see image below).

Creating the Content Cloud Page Id as a parameter for Events

Next, create a ‘Relationship’ between Events and your custom object.

Creating a relationship between events and your custom object

Pass your Page Id in ODP Events

Another important step happens in your browser. Here you must pass your custom object’s ID field with all events that relate to your page.

// From the OPD Web SDK's Javascript Tag
zaius.event('pageview', {
content_cloud_page_id: '@((PageData)Model)?.ContentGuid'
});

In the above example, I have attached the page’s ContentGuid to the pageview event. This is fired on every page load.

zaius.event('web_modal', {
action: 'click',
action_sub_type: 'add_favourite',
content_cloud_page_id: '@((PageData)Model)?.ContentGuid'
});

In the this example, I have attached the ContentGuid to a custom event that is fired when a visitor clicks to add a page to their ‘favourites’.

Create Real Time Segments tied to your content

Having done all this, ODP now knows about your pages, and now your visitors’ events and observations can be related back to those pages.

You can now go to ODP and create a segment based on your visitors’ affinity to your content.

If we again take the example of a ‘news site’, you could segment visitors who have opened 10 sports articles in the last two weeks…

An example RTS tying our pageview events to our CMS Pages

… or alternatively, target visitors who have favourited 3 or more articles in the last 5 days where the article is of the category ‘finance’ and also tagged with ‘interest rates’.

An example RTS tying our custom events to our CMS Pages

Personalize your content

Now you can use these Real Time Segments to personalize your content in the same way I mentioned earlier in the article. That is, you can use the them as a criteria for your CMS Visitor Groups and activate personalization on them in your website.

Summing up

Using the Optimizely Data Platform allows you to implement highly personalized experiences in your Optimizely Content Cloud website and in real time.

If your personalization strategy is more concerned with your content than your customers and products , you can still unlock the power of ODP personalization with just a bit of extra setup.

Contact

If you’d like to talk more about Optimizely and the ODP or need help with your implementation, contact me at Orchard through hello@orchard.com.au.

--

--

Daniel Copping

Web developer based in Tasmania, Australia. Interested in dotnet CMS technologies such as Optimizely, Umbraco, Kentico and Sitecore.