Naturally, this feature is made for more advanced website strategies. The first thing you need is a concept of how you want to segment your visitors. Sulu allows you to create individual rules and here it can get tricky quite fast. So a very good conceptual preparation is very much recommended.
The next step is to make a plan which content on the site will be adapted for the audience groups. It is important to keep in mind that only certain parts of a page will change and not the whole page itself. In the simple example below an individual headline is displayed for each audience group. Make sure you also check the impact to your site's SEO as robots will normally not be added to an audience group.
Once you have got these basics together you can start to configure your target groups and you content.
Create target groups
The dialogue for the target group includes some default fields like the title, description and a toggler to activate or deactivate the target group.
The dropdown for webspaces lets you decide on which of your websites the target group is made available. The priority describes how important the target group is. With this value you can define the importance of an target group in relation to others and is especially usefull when the visitors changes from one target group into another. This is only possible when the new target group has a higher priority than the last one.
Set the rules
It is the rule set where the real magic happens because here the actual conditions that decide how a user is being chosen for a target group are defined. The mechanism is quite simple: every time a user visits the website the system checks if any of the rules are matching. As soon as one rule is matching the visitor gets the corresponding target group assigned. It's also possible to define when the rule set is evaluated:
- on each page that is being visited (hit)
- when a new session was started (session)
- only at the very first visit (visitor).
A rule set matches if all its conditions are fulfilled. An example for a condition is the browser of the user, the language setting on his computer or the operating system he is on.
Assign target groups to content
Now lets assume a few target groups have been defined. On their own there are pretty useless but they get powerful in combination with the website content. At this stage of development the audience targeting works with the following types of content in combination with the smart content type:
Whole pages can be added to one or multiple target groups. The smart content can then be used to create a list of pages (e.g. a category overview page) only assigned to a certain target group.
Assign snippets to target groups and then use the smart content to create individual versions of a web page by showing only the dedicated snippets for each group.
Any asset (photos, documents etc.) can be added to target groups. By using the smart content to include the media into a page the target group can be used to filter the assets according to the groups.
To assign content to a target group open the "Taxonomy" tab and add the desired group.
Use target groups in SmartContent
To actually filter content for target groups the Smart Content is used. The dialog now offers a "Use target groups" checkbox which activates the function when loading the pages. Developers can of course use the target groups for whatever they want when they are building there own custom extensions for Sulu.
Considering target groups when loading pages means that it will only load the content which has the target group of the visitor assigned. And all of this is still super fast since HTTP caching is still applied!
So far, the audience targeting is already a very powerful feature and we can't wait to see what you are building on top of it! You can expect more functionalities in the future so please give us feedback. We very much appreciate it.
And stay tuned as there will be a follow-up blog post explaining the technical details for this feature.