Stir it Up! Cache-Friendly Content Mixing

Content Mixing in WordPress

A good mix of content keeps visitors engaged on your site, particularly if your site is content heavy. But, keeping things fresh requires a good mixture of internal content links, some of which are going to work better than others. Many sites expose these links through “related” or “most popular” lists in sidebars or after content on article pages (where most readers go for content), as well as through lists with selections from specified categories or tags. In these situations, we would typically expose a few links out of a larger pool of content. And, to ensure fresh content in these lists, we would generally apply some level of randomization.

One major downside to generating randomized lists of post links is the amount of computational strain on the CMS engine that renders these links for each page load. This strain on the CMS can cause poor back-end performance, resulting in slower load times on your HTML pages. In other words, it’s extremely taxing on your site’s performance to generate these lists and you would thus cache their output; but they’re not truly dynamic if they’re cached, so users would get the same content each time they load your site. There is a solution for delivering plenty of fast, scalable content to your audience without impacting the speed at which the site loads. We refer to it as content mixing.

Content mixing is a front-end cache-friendly technique that stirs up fresh content with each page load, offering a new mix of information and different links for a more dynamic site. By creating new paths through the site, it can increase re-circulation and provide more coverage of site content without overwhelming your visitors with too many links. Best of all, it greatly reduces the potential for strain on your site. The content mixing system uses simpler queries without any sort of randomization on the server side and outsources the randomization effort to the client. This sleight-of-hand is accomplished by using simple web technology: Generating the pool of content in your server-side language, producing it all in the rendered markup, and stirring it up with JavaScript. See our content mixing examples on GitHub for an example in WordPress.

Of course, displaying random content is only part of the story. Content mixing can also be leveraged for better content optimization. You can use it to analyze the relative performance of links by leveraging your analytics system, comparing the click rates of circulation links against one another along with their placement on the site. One way to do this is to add event trackers in Google Analytics for click events on content-mixed links and include an additional “position” parameter. This allows you to measure how effective a given post is in a given position, using the tools offered by the analytics back-end. With this knowledge, you could add an additional weight parameter to the mixed posts, and fine-tune the display of selected posts so that better-performing posts will be seen more frequently.

Like all software design decisions, there are a few side effects to consider. For instance, when a user shares a page link because of a specific piece of content found in one of these lists, those who follow the link may end up seeing an entirely different page due to content mixing. It goes without saying then that content mixing should be applied only to secondary content.

Another nuance is the potential complexity introduced by adding logic to track which items (i.e. links to posts) have already appeared, as a means to prevent items from appearing twice in two different mixed-content areas. If a particular post appears in multiple content-mixed areas, it’s a bit more complex to exclude that post from subsequent content-mixed areas of the page when it is exposed in a previous pool.

We have used content mixing for our content-heavy client sites, like Reader’s Digest, RD.com, with great success. As a general rule, regular visitors to a site like to see fresh content each time they stop by, which keeps them coming back and may increase the time they spend on the site (positively impacting ad revenue). Content mixing offers a reliable way to deliver new content without burdening the site, and can inform performance analytics.

So, stir it up. And, let us know what you think.