Smoothing Out the Rocky Road to Personalization - Part 3: Personalization in dotCMS

$URLMapContent.title

Smoothing Out the Rocky Road to Personalization - Part 3: Personalization in dotCMS Posted: 09.13.2017

Personalization-Post3

dotCMS is an open source, enterprise Java CMS built from the ground up both to use open-source Java standards and to allow you to easily use your own Java code to override or extend dotCMS functionality. Although dotCMS was explicitly designed to make it easy to extend the functionality with your own Java code, dotCMS supports key personalization features natively, which minimizes the work needed to implement personalization on your site so you can focus your own coding efforts on truly sophisticated and custom needs. As we'll discuss shortly, some fairly demanding personalization features are available out-of-the-box, and you can start implementing fairly sophisticated personalization in dotCMS with as little work as changing the name of a single method in your server-side script.

Built-in Personalization Features

dotCMS ships with several very powerful personalization features that address the most common (and most difficult to implement) personalization tasks without having to write your own code:

  • Visitor browsing behavior is tracked automatically, so you don't have to write any code to determine and track visitor preferences; all you have to do it use the information.
  • Personalized content listings (which automatically display content a user is most interested in) are built-in and simple to use; no special coding is required to implement personalized listings.
  • User profiles are implemented via the built-in Persona content type which allows you to create, customize, and reference Personas directly from content and to tie specific content to specific Personas.
  • Rules allow you to define conditions that trigger customization actions without coding, at any level from individual pages to your entire site.  Many of the most common conditions and customization actions are built-in (selectable from a menu), and you can create your own custom conditions and actions via a plugin using your own Java classes.

Each of these features can be used independently (so you can choose what order to implement different personalization features on your site), but they're also fully integrated with each other so that any work you do to implement one of these features is automatically picked up and used when you begin using one of the other features. This gives you the ability to choose what order to implement different personalization features on your site, while also providing the ability to upgrade to rich, sophisticated personalization features with clear and incremental efforts.

Personalization Features are Customizable

    If you wish to change the way the personalization features are implemented in dotCMS, you can easily do so in a number of ways.

    Validation and Testing Considerations

    As discussed in part 2 of this series, since personalization means that each individual user can potentially see a different version of your site, it can be very challenging to validate and test your site once you've begun implementing personalization. dotCMS provides several built-in features to make it easy to manage some of the most important practical considerations of validating and testing personalization on your site.

      Viewing Personalized Content

      dotCMS makes it easy to choose how you view any page on your site, allowing you to view and validate how each page displays, taking the personalization features you've implemented fully into account. This includes:

      User Types: View as Persona

      You can view any page as a specific Persona (selected from the Personas you define), to ensure the content displays appropriately.  All content in the page is then displayed as if that Persona had been assigned - without the need for you to execute code to ensure a specific Persona is assigned for your testing.

      Localization: View as Language

      You can create multiple language versions of each piece of content on your site, and display how each page will display for a user who has set their language to any language you've defined.  Although it's outside the scope of this article, dotCMS also provides many sophisticated ways to identify a user's preferred language, from the URL used to access a page, to the user's browser language, to geolocation.

      dotCMS demo site shows an example pull-out that allows you to view personalization information (including automatically collected visitor browsing behavior) and change Personas on the fly to see the changes on the front-end site.

      Layout and Style: View as Platform

      A number of platforms are pre-defined in the dotCMS starter site (e.g. iPhone 5, iPad, etc.), and you can create and define the parameters for any additional platforms you wish to support.

      All of these capabilities can be used together, by simply selecting a value from a drop-down list and viewing the changes to the way the page is displayed.  And all of these selections can be modified and customized to display the selections you need to properly view and validate your site.

      SEO and Site Search

      As discussed in part 2 of this series, personalization can also present challenges when your site is indexed by robots such as search engines or your own site indexing processes (or perhaps your automated testing processes; see below). dotCMS enables you to decide what content to display when your site is indexed by providing information in the User Agent header that identifies when your site is being crawled by specific processes.

          In addition, you can create multiple URLs to access the same page using the dotCMS Vanity URLs feature. This feature allows you to create multiple entry points into your content, each of which may either display different content (and be indexed separately by search engines), or all point to the same content (with the canonical URL set appropriately to maximize your SEO).

          Standardized Content Handling

          One important consideration is how different types of content (such as products, promotions, blogs, etc.) are handled; if content of multiple different types can be accessed using the same methods, a single code base and single set of testing protocols can be used for multiple content types, which greatly reduces both the implementation and testing efforts.

          All content in dotCMS is handled the same internally, and may be customized and extended. All content types have certain standard fields and methods, and you can add fields to any content type in dotCMS (including standard built-in types) without changing the way the content is accessed. This allows you to write code which accesses content in standard ways, regardless of content type, thus minimizing both your development and testing efforts.

          Automated Testing Support

            Another very important consideration for modern development teams is support for automated testing; personalization can present some serious challenges for automated testing efforts, both in scope (how many automated tests need to be performed) and in execution (how to ensure the automated tests trigger the appropriate personalization features with the appropriate values).

            dotCMS Personas provide a way to help manage and potentially limit the scope of automated testing efforts, since they can be used to define and then test the most important use cases without testing potentially unlimited variations in individual visitor browsing behavior.

            In addition, dotCMS also provides fine-grained control over testing execution in case you need it.  If you wish to test for specific visitor behavior you can manually manage the visitor information (including browsing behavior, assigned Persona, rules triggered, etc.) via scripting and Java code; for example, specific content tags can be inserted into the visitor's browsing behavior before your tests display the page.

            The combination SEO and Site Search features (above), Personas, and fine-grained control over visitor information gives you an incremental path toward implementing automated testing. You can begin by simply identifying when automated tests are accessing your site and display a single specific version of your content for your tests, later expand your testing to test the display for different Personas, and then finally implement tests for specific visitor behaviors as needed.

            Scalability

            As we discussed in Part 2 of this series, web developers need to be concerned with two different types of scalability: execution scalability and implementation scalability.

            Execution Scalability

              dotCMS has deep and proven execution scaleability, from a single server to enterprise-scale clusters with load balancing, fail-over, on-demand scaling, and multiple "9"s of availability, either on-premises or in the cloud. dotCMS is in use by many large multinationals and Fortune 500 companies to run their public facing web sites which receive millions of unique visitors a day; in fact some existing dotCMS implementations run over 1000 different public facing websites on a single dotCMS instance, all scaled within a flexible managed cloud infrastructure.

              dotCMS provides this execution scalability using industry standard application servers, databases, Java libraries, and tools.  dotCMS code is open-source (available on the dotCMS Github repository) which enables developers the ability to validation, extend, and if necessary customize the dotCMS platform for specific applications and performance requirements.

              Implementation Scaleability

              Personalization features in dotCMS are explicitly designed to offer an incremental, step-by-step approach to adding personalization to your site. Implementing personalization in dotCMS can be performed in several stages, each of which can be implemented in a targeted way (such as a single page or single type of content) and scaled for greater coverage up to the entire site.

              Step 0: Tracking Visitor Behavior

              This is numbered step 0 because it isn't really a step at all, it's a built-in feature. dotCMS automatically tracks the tags and counts of all content a user browses on your site, giving you a detailed picture of the types of content a visitor is interested in. Each visitor to your site is uniquely identified, and their browsing behavior is available to you via both scripting and Java code, using the tags (and thus the topics) you decide are important. This means that determining visitor preferences - one of the more challenging aspects of personalization - is handled automatically out-of-the-box.

              Step 1: Personalized Content Listings

              The simplest way to begin implementing personalization in dotCMS is to add personalized content listings. Personalized content listings allow you to create content listings that are automatically scored and sorted based on the visitor's browsing behavior and other personalization features (such as Personas) if you've implemented them. In addition, the content pulls are standardized so the personalized content pull is identical to the normal content pull except for the name of the method, so changing a content listing from a standard listing to a personalized listing requires changing a single word (the method call) without a need to even change any of the arguments to the call.

              Step 2: Define Personas

              Personas are built-in to dotCMS, are easy to create, and are automatically incorporated into personalized content listings once they're created. Unfortunately there's no way to automatically create and assign the Personas that are appropriate for your site; you must define your own Personas, and you must create the conditions that are used to assign Personas to your site visitors.  However dotCMS makes it easy to assign Personas using Rules that can check for sophisticated conditions without the need for writing any code, and that allow you to easily add your own conditions with dynamic OSGI plugins. And once you've created Personas and assigned them to a visitor, you can easily tag content appropriate for different Personas, so that content automatically displays higher in the personalized content listings for those visitors.

              Step 3: Page Rules

              dotCMS Rules can be assigned to individual pages or to an entire site. This means that you can get started with Rules on a single key page, and then add Rules to additional pages as needed, without committing to (and requiring testing for) your entire site. You can also implement a single Rule for multiple pages by adding a rule at the site level, and then simply adding a condition to ensure the Rule is only evaluated when specific pages are accessed. Rules are flexible enough to allow you to start small and expand as your needs grow.

              Step 4: Site Rules

              Once you've gotten your feet wet with Rules on key pages, you can begin implementing Rules for your entire site. Implementing Rules for a site works exactly the same way as it does for a single page, with the simple addition that you can choose when the Rule is evaluated for each visitor - on every request, every page, once per visit, or just once (the first time they visit your site).

              Step 5: Customization

              Finally, when you're ready to begin extending your personalization efforts beyond the built-in personalization features, dotCMS makes it easy to customize the way the built-in personalization features work for your site, both directly and using your own Java code. There are several ways to begin customizing personalization features:

              Apache Velocity for Server-Side Scripting

              dotCMS provides native support for Apache Velocity for server-side scripting. Although Velocity is not as well known or used as PHP or JSP, there are two nice things about Velocity that are important for Java developers:

              1) It's simple and relatively intuitive to learn and use.

              - The syntax is simple, and is distinct from and easily managed within HTML code.

              2) Most importantly, it's really just a thin layer over Java.  This means:

              - Velocity makes it extremely easy to call into your own Java classes.

              Making your own Java class available within Velocity code is as simple as adding 5 lines for the class in a configuration file.

              - You can access Java methods (including all methods of native Java types, such as strings, integers, etc.) from within Velocity code.

              This means you can use the same methods in your server-side scripting code as you do in your Java code, and this greatly simplifies both normal server-side scripting and the customization of your server-side scripting with your own Java code.

              All dotCMS personalization features are accessible via Java code and via server-side Velocity scripting code.

              Plugins

              You can override the core dotCMS code or extend dotCMS code with your own Java classes using dynamic OSGI plugins. OSGI plugins can be loaded and unloaded dynamically, without stopping the dotCMS application, and OSGI plugins can be "pushed" from your development server to your production server through dotCMS, without the need to directly copy files to the production server.  This plugin architecture makes it easy to use your own Java code plugins, and simplifies the development, testing, and deployment of your plugins.

              Common Personalization Customizations

              The following personalization features can be easily customized using the above methods:

              • Personas can be extended to add both additional information (content type fields) used in decisions and display, and your own custom code (via custom fields).
              • Personalized content listings can be easily customized via Velocity code. Example Velocity code is provided which demonstrates how the built-in personalized content listings are implemented, giving you a template to modify or change both how content is pulled and how it's filtered and sorted for your own personalized content listings.
              • Rules can be customized to add your own conditions and actions via plugins. Documentation and sample plugins are provided to make it easy add your own conditions and actions allowing you to extend dotCMS Rules to do almost anything you wish on your site. One of the benefits of adding your own conditions and actions is that it allows you to extend customization in the form of small reusable building blocks, which can then be combined together easily and incrementally over time to perform sophisticated personalization and customization.

              dotCMS personalization features were designed to allow you to quickly and easily begin implementing personalization on your site, to provide many of the most difficult personalization features out-of-the-box, to ease validation and testing efforts, and to enable you to expand and customize your personalization features using your own Java code in an incremental and agile way.

              Customization of personalization features certainly doesn't have to be the last step, and there are opportunities to tune and modify the dotCMS personalization features with your own code at every step along the way. However one of the greatest values of dotCMS personalization features is that you don't need to write any of your own code to begin implementing personalization, or even to deliver some types of rich personalization for your site. dotCMS provides the core personalization features that smooth out the implementation of web site personalization, and enable you to focus your coding efforts on the areas that will provide the most additional value to your site.

              -------

              For more on personalization, read parts 1 and 2 of this series:

              Part 1: Giving Users What They Want

              Part 2: Implementing Personalization