Thursday, 28 June 2018

Sitecore Personalisation with CDNs

A typical user interaction between a user and Sitecore with a CDN in the middle looks like:
Whilst this is great for the first user who requests that particular resource, problems with recording interactions and slotting users in to personas start arising when the resource (typically html) needs to be cached to  minimise delay. Since the request will never get forwarded on to Sitecore, there are essentially 2 problems that arise from this:
1 - How to register user interactions
2 - How to return the result of a user request such that the response is personalised.

So how about we amended the request/response to look a little like:
All that is needed is for components that have been stripped of their inner html (and thus personalisation removed) is to be marked as such with the relevant rendering ID's also included. When the personalised response is retrieved directly from Sitecore, all that is required is for a small client side script to parse the personalised html, loop through all the "depersonalised" components on the already loaded in the DOM, and then extract and replace the DOM accordingly.

The animated gif below shows Sitecore's ootb site in action with this module:
Sitecore logo is a personalised rendering which is injected in once home page 2 is visited in the same session

The github code is located here: https://github.com/brimfulofashar/Sitecore-CDN

No comments:

Post a Comment