Content Personalisation in Drupal
Tailor your websites content to your customer to give them a great user experience
Many organisations wish to offer personalised content and services to their users, with the possible solutions ranging from simple to complex and very expensive. In our experience, there’s definitely no one-size-fits-all approach that is applicable to all clients, so we try and ensure we match the solution that provides the highest business value.
A key consideration when offer personalised content is context, which may include:
- User is logged in or anonymous
- User belongs to a role
- What part of the site the user is in
- Time of day, day of week
- User selected preferences, e.g. topics they have chosen in their profile
- Using a mobile device, tablet or at a desktop
- Past event registration
- Past order history if on a shopping site
- Past articles viewed
The most simple personalisation can be handled using Drupal 8’s built in condition API. You can create two blocks with different content, and switch them out based on their visibility rules (e.g. show this block for anonymous users, this other one for logged in users). This also applies to user roles, so for example, you can display a block with the current logged in users for a site administrator.
The Condition API is extensible with plugins. That means with a little custom code, you can create your own custom conditions for showing or hiding content.
This could be done, for example with a Time of Day condition, or Day of the week condition.
Taking it one step further, if you can utilise a common taxonomy for both user preferences, and content, you can make a simple condition that can match the right content with the right user. For example, if the content is tagged with ‘power tools’ and the user has selected they like ‘power tools’ in their profile, we can simply display content that matches their ‘liked’ categories. This can evolve over time to provide highly contextual personalised content.
Matching Multiple Conditions
When you start to need to match on multiple conditions, you may be faced with the problem of fragmentation. That is, trying to match the right content will be too specific and you may not have enough content to satisfy all the possible combinations.
This is where some tools come into play which let you do some experiments and see what works and what doesn’t.
In Drupal 7 you can use the Personalize module. This abstracts out the process of personalisation into the key components:
- Campaigns: A way to group together a personalisation feature
- Decision agents: Makes the choice of what to show based on a number of factors provided by user contexts
- Option sets: You provide the choices for which content can be displayed
- Visitor context: All the different bits of information that can be used to make a decision by a decision agent
What happens when you have so much user context, and so much content metadata that it’s impossible to make decisions about what to display? This is where machine learning can help.
A an example batch analysis workflow is:
- Extract all known metadata for your users and content into a standard text format (e.g. CSV) or cloud nosql database storage service (e.g. Amazon Dynamo DB)
- Provide the machine learning service with a small set of training data (e.g for these users, assign these category preferences)
- Run your extracted metadata through the machine learning service to have it provide the best guess category preferences for users and update your database
- Import the user preferences back into the site
The machine learning service has given you the best guess at what the user preferences are, so you can go back to the simple process of matching user category preferences with content. Alternatively, you can plug the results into the Personalize module, providing an alternative to a proprietary service like Acquia Lift.
You can take this one step further by calling the analysis service on a regular basis. Typically this is a more complex approach, and the costs become higher.
Before you spend tens of thousands of dollars on a hosted personalisation service for your Drupal site, we’d recommend you start by looking at what you can do with existing Drupal modules and cutting edge cloud services.