ShowTable of Contents
Personalized content is highly demanded in all content-driven portals to better guide you to your area of interest; for example, a corporate portal would display alerts for managers other than those for employees, and an Airlines portal would better display holiday offers for destinations to which you can fly from your current location. Another eCommerce portal would better display commercial advertisements available in your area, etc.
IBM® Web Content ManagerTM
(WCM) provides the content and can be combined with Personalization rules based on site visitor profile attributes to decide which content is displayed to which user profiles.
Using a hands-on exercise, this article shows how to use WCM 7.0 and Personalization rules to provide personalized content functionality for a WCM-driven portal. It is intended for content designers who are interested in implementing Personalized sites using WCM 7.0.
To get the most from this article, you should be familiar with WCM components and the personalization engine, and have high-level knowledge of IBM WebSphere® Portal Administration.
Personalization in WebSphere Portal is used to automatically customize a Web site for individual users and groups. There are three types of Personalization in WebSphere Portal:
- Simple filtering. In this type, content (pages, portlets, WCM elements, etc.) is displayed based on user access rights; for example, the managers group can view more links and content than the employees group.
- Rule engine. In this type, content is provided based on business rules that define what content should be displayed when a specific profile visits the site.
- Collaborative filtering. In this type, users rate content items (for example, products) and visitors receive content based on the ratings of others.
We focus on the second personalization technique (rule engine) in this article.
For more information about Personalization in WebSphere Portal, refer to the Personalization Overview topic
in the IBM Web Content Manager 7 product documentation.
Example of providing personalized content
In this example we develop a personalized content component to display a set of customized content for site visitors according to their country of residence. This depends on the user profile attribute countryName.
Though this example is meant to be a simple demonstration of integrating WCM and Personalization rules, in real scenarios the same technique can be extended to make complex business rules based on combinations of user profile attributes that could be customized according to business schema.
Setting up for the example
In this example we need to create a few users with different countries of residence. To do this we use the default registration portlet, even though by default this portlet doesn't display a field to accept the input of countryName attribute.
Figure 1. Default registration portlet
So, we must configure this portlet to display an input field to capture a user's country during the registering or profile editing process. To do this, follow these steps:
- Log in to WebSphere Portal as an Admin user and navigate to the Administration tab.
- Go to the Portlets section and search for the Profile Management portlet.
- Click the wrench button to configure the portlet.
- Navigate to second properties page and edit the preference “wps.portlets.displayed_user_attributes”.
- Add “,countryName” to the end of the list of displayed attributes in the Value section.
- Click OK to save the changes and OK again to close the portlet configuration window.
Now if you log out and return to the Sign Up page, you will see that a new input field, countryName, has been added to registration form (see figure 2).
Figure 2. Registration portlet with countryName field added
Let's create three users to represent users from different countries to be used in the example (you can also create one user only and change his countryName attribute via Edit profile, as needed).
- Navigate to the Sign Up page.
- Fill in the form with proper values and enter “Egypt” in the countryName input field.
- Click OK to create the user.
- Repeat Steps 1---3 to create two more users with countries “Qatar” and “UAE” in the countryName input fields.
Creating the content
In this step we create a few content items to represent our commercial offers and add to each offer the set of countries in which the offer is valid. This value will be used later to compare to visitors' countryName attribute to display the list of offers available in his country.
Creating Authoring template
The first step toward creating content is to create an authoring template, “Personalized Content”.
Figure 3. Authoring Template window
- Log in to WebSphere Portal as a WCM administrator user.
- Select Applications --- Content --- Web Content Management.
- Click New --- Authoring Template, and enter the name and description, as shown in figure 3.
4. Select More Actions –- Manage Elements, to define the elements within this Authoring template, and add the element types as shown in figure 4.
Figure 4. Element types
5. Click OK, and then save the authoring template.
Creating Site Area
In this step we create a Site Area in which to group the personalized content items.
Figure 5. Site Area form
- On the WCM landing page, select New --- Site Area (this Site Area is used to group the personalized content).
- Fill in the new Site Area form as shown in figure 5.
3. Edit the Access settings in the Properties tab to make the Site Area accessible for all authenticated users; save and close the Site Area.
Creating Content items
Now we create some content items to represent personalized content items valid in some countries.
- While you are on the WCM landing page, select New --- Content.
- Select Personalized Content AT in the Authoring Template selection window and click OK.
- Fill in the fields of the Content item with valid data, and enter “Egypt” in the ValidityCountry field.
- Select Personalized Content site area as the location of the content.
- Select Express Workflow in the Workflow section, to directly publish the content
- Save and close the Content item.
- Follow Steps 1---6 to create a few more content items that are valid in the other countries, Qatar and UAE.
- Do the same to create some Content items with the word “any” in the ValidityCountry field,
- Do the same to create some content items that are valid in more than one country, for example, Egypt and Qatar, or Qatar and UAE.
Steps 8 and 9 above are performed to test the behavior of the Personalization engine. Also, in real-life scenarios you might have content that is valid for all users or subsets of them, so this simulates this case. Figure 6 shows the five Content items created.
Figure 6. Content items
Creating Personalization rule
In this step we create the business rule that will be used to personalize the content rendering.
- Log in to WebSphere Portal as administrator and select Applications --- Content --- Personalization --- Business Rules.
- Select News --- Rule, and fill in the details of the new rule name, description, and location.
- Select “Select Action” as the Rule type.
- Select the “Personalized Content” Site Area as the Location attribute. To do this, click on the word “value”, and click the “Select Location” menu item. This step guides the business rule to search and collect only those Content items under the Personalized Content Site Area, thus improving performance.
To customize the rule we need to confirm that the content parameter “ValidityCountry” contains the logged-in user's country. To do this, follow these steps:
Figure 7. Business rule customization
- Click on the word “attribute” and select Authoring Template Properties --- Personalized Content AT --- Validity Countries (see figure 7). Click on the word “is” and select “includes” instead of is.
- To specify the value, click on the small arrow beside the word “value” and select Portal Users --- countryName.
3. Add another condition to select content with no specific country as well:
a) Click “Add Condition” and select the “Validity Country” authoring template attributes.Figure 8. View Rule tab of Personalization Editor window
b) Click on the word “value” to display a text field in which to enter the value; type “any” and click Submit to create the condition.
c) Change the “and” operator to “or”, to indicate that the union of the two conditions should be returned.
d) Select “Save” to create the new rule; it should like like figure 8.
Testing the Personalization rule
After saving the business rule, we can test it from the Preview tab, which displays a list of content items selected by application of this business rule.
1. Select the Preview tab while logged in as an administrator; this displays only the “General Content” record (see figure 9).
Figure 9. Preview tab with General Content record (countryName is empty)
2. Edit the user's profile, adding “Egypt” to the countryName attribute, and again preview the business rule. Three records, Egypt Content 1, Egypt Content 2, and General Content, display (see figure 10).
Figure 10. Preview tab with Egypt records (countryName is Egypt)
3. Edit the profile again, entering Qatar as the countryName, and preview the rule; figure 11 shows the result.
Figure 11. Preview tab with Qatar records (countryName is Qatar)
So this confirms that the business rule is working correctly and is selecting the correct content according to the logged in user's country and the Validity Country attribute of the content. The next step is to integrate this rule with WCM to render the selected content.
Creating the WCM personalization component
To render the personalized content we use the WCM Personalization component. This component is much like the Menu component, except it is based on a Personalization rule and, as is the case with the Menu component, you must enter Header, Body, and Footer for the results:
- Navigate to Applications –- Content --- Web Content Management.
- Select New --- Component --- Personalization.
- Fill in the name and description fields on the new Personalization component.
- In the Personalization Element section, click Search, select the PersonalizedContentRule we created in the previous step, and click OK.
- In the Header section, enter the markup for the header as follows:
<table cellspacing=5 cellpadding=0 border=1 style="width:500px;font-
family:Tahoma;font-size:small;"> <tr><td colspan=2 style="padding: 10px;text-
align:center;background-color: #BCD2EE;"><b>Personalized Content for your
6. In the “Design for each menu result” section enter
<td style="width: 30%;padding: 10px;text-align:center;background-color:#EBECE4;">
[Element context="autofill" type="content" key="Image"] </td>
<td style="padding: 10px;">
<b>[Element context="autofill" type="content" key="Title"]</b>
[Element context="autofill" type="content" key="Details"]
7. In the Footer section enter , to close the table.
8. Navigate to the Properties tab and check the Access section, making sure that the component is available for All Authenticated users.
9. Save and close the component.
Next, we render the content on some test page, using Web Content Viewer and following these steps:
Figure 12. Web Content Viewer instance configuration
- Navigate to Portal Administration --- Manage Pages, and create a New page under the Home label.
- Fill in the necessary fields to create a new Standard Portal Page.
- After creating the page, edit its access rights to make it available for all authenticated users.
- Edit the layout of the page by clicking the Edit button (the pencil icon).
- Select Add Portlet, select Web Content Viewer (JSR 286), and click OK.
- Press Done to confirm deploying the portlet instance to the page.
- Edit the page layout again to configure the Content Viewer Portlet to render the Personalization component.
- Select Edit Shared Settings from the portlet instance context menu and configure the portlet instance as shown in figure 12.
9. Click OK to save the shared settings, and click Done to close page layout editing.
Testing the personalized content
Now it's time to test the personalized content by logging in with the different users we created earlier in this exercise (you can also use one user and modify their countryName attribute from the Edit Profile page). You will see how the personalized component dynamically changes the list of displayed content items according to the logged-in user:
Figure 13. Personalized content for EgyptUser
- Log in with EgyptUser and navigate to the Personalized Content page. Note that there are three Content items rendered in the menu, two of which are related to Egypt and one is General (for all users), as shown in figure 13.
2. Now log in with QatarUser and navigate to Personalized Content page (see figure 14).
Figure 14. Personalized content for QatarUser
3. Finally, log in with UAEUser and navigate to Personalized Content page (see figure 15).
Figure 15. Personalized content for UAEUser
The Personalization engine within IBM WebSphere Portal is used to build business rules based on user profile attributes and various other factors. These business rules can be used to personalize the WebSphere Portal site in many ways to better serve business needs.
In this article, we have discussed an example of using business rules to personalize content that is displayed to users based on their country. It's meant to be simple, to demonstrate the use of personalization with WCM 7.0, and you can use the same technique in real-life implementations by adopting a more robust design.
About the author
currently works as a Senior SOA and WebSphere Portal specialist and as a Subject Matter Expert (Portal & WCM) at GBM Qatar (IBM business partner). He previously worked as a Software Engineer at IBM Egypt in the Cairo Technology Development Center and has more than 7 years of experience in implementing WebSphere Portal and SOA solutions.