This post is written for those of you who have not yet upgraded to 6.2 (for whatever reason) but still want to give specific content to specific users. My goal is to present some of the code and process for implementing content targeting on 6.1 as well as explain the underlying theory of content targeting to stir up your creative developer side, no matter what version of liferay you are on, so that you can implement it in any situation.
Two Methods: Location & Persona
Whether you know it or not, you target content all the time. Maybe not on your website, but it is a normal part of social interactions. As you meet and get to know people you tailor your conversation (your content) to what you know about them. If you have a friend who lives Chicago, when you talk with them you probably ask how it is there, anything from the weather to current events in the area. If you know that a person likes a certain type of music or activity, your conversations often center around those topics, because they are points of connection. Communication is about connection. Relationships last when both parties are mutually engaged in the communication. Whether its a person you meet on the street, or a long time friend, the more connections you have the easier it is to communicate.
The same is true for your website. You have a relationship with your user, and the more they connect with you the more you can connect with them. This is why content targeting is important. When you communicate relavant content, they are more interested and more invested. This is key for a good user experience.
There are lots of ways you could connect with your sites visitors and target content for them, but this post will mainly focus on two: location and persona.
Location-specific information is prevalent with smartphones and can also be beneficial for content on your website. However, instead of only depending on GPS or IP to locate people, you should also gather location information via your forms and then deliver content that applies directly to them, even if their devices do not support location detection. Specifically, if I know that a visitor on my site lives in Brazil, then I would want to tell them about our Brazil Symposium, even if their current IP address registers in Africa.
Using personas is another logical way to provide relevant information to users. A persona is a fictional character that represents a particular group of people who use your site. Since many companies employ several people to serve various roles, two people from the same company might be visiting your site with different objectives. For example, if you work at a tech company, your company website probably attracts many visitors with programming or CEO backgrounds. In this instance, you could define at least two personas, a technical end user and business decision maker.
To target both audiences, there are three things you should do: record information about the user, review the information you've gathered, and then render the relevant content.
The first step in content targeting is figuring out who your users are. If you do not know key information about your visitors, you will be unable to provide them relevant information. The easiest way to obtain information is to ask them for it.
For instance, if your site features a user sign-in, then you can add custom fields to your user that are required on sign-in. If you're trying to determine their location, you can create a "Country" field to capture that information. Or if you want to discover the persona-type they most align with, you could use fields such as Company Role and/or Department. (For specific instructions on how to do this, refer to Custom Attributes.)
Other ways to record data about your users can involve deploying the IP Geocoder plugin, which can take the user's IP address and determine their country, or integrating with third-party software. A product like HubSpot integrates well with Liferay and allows the ability to track user information, which means you can later retrieve that data to deliver relative content.
Once you have recorded all the information you want, you can simply pull that information into a web content template and do a little logic to output the desired values. In my example I create a template with all the logic, and then I am able to parse that template in any other template I want to run the same logic in.
After rendering this template in another template, the variables $target_country and $target_persona will be available for me to use them however I choose.
The last step is to render different content for all the various target audiences. There are several ways to do this, but a relatively easy method is simply embedding a web content portlet with a specific instance ID based on your selected persona or country. The drawback is that you have to select the web content for each persona or country you are targeting (but you only have to do that when you set it up, so it isn't that difficult).
I've provided several code examples for you to see the idea/logic behind it and tailor it to your site (the code examples won't just work if you copy & paste it—sorry!). Of course, I would recommend using Liferay 6.2+ simply for the fact that you can download the Audience Targeting App and it will do all of this and more for you. However, even if you do use the Audience Targeting App, it's important to understand who you should be targeting and how it adds business value to your site.
How do you target content on your site? What methods or approaches besides location and persona have you found effective? I would love to hear your feedback and see how all of you are engaging your audiences.
To find out more about Content Targeting and how we do it on liferay.com, check out my recent session from our 2014 Liferay North America Symposium.
You can check out the *New* Audience Targeting App or learn more about it from Ed or Julio's symposium talks.
*Photos taken by Sharon Mollerus and Daniel Coy