Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Overview

This module is capable of automatically setting a cookie for the node id or taxonomy term of the most recently viewed content by the user. It can help you show personalized, ever-changing, ever-up-to-date views, without depending on external services.

Example: the user looks at a blog post about computers. Then when they go back to the homepage, they see a block view of all content about computers. Later, when that same user reads a blog post about ninjas, the block on the homepage will then show all content about ninjas.

Details

This module adds two default argument plugins to views that allows you to use a cookie as the argument. It also provides several mechanisms for setting the cookie automatically:

  • Taxonomy : set a cookie for selected vocabularies that tracks the most recent term on content that the user has viewed
  • Content type : set a cookie to store the nid of the most recently viewed node from the selected content types
  • Exposed filters : set a cookie for the inputs in views exposed filters

In addition, you can also use *any* cookie name as a default argument. This will allow you to store your own user specific arguments for views. In this way, you can also use this to provide some of the functionality of a global views filter, to personalize content for anonymous users, and to show relevant content based on the user's actions. Its very simple, but powerful.

Caching & Varnish

These plugins are set to provide a cache context for each cookie name as it is set. This allows it to be very flexible about providing up to the minute views while still allowing you to be able to cache those results to a certain degree.

If you are using Varnish, you will want to make sure that Varnish:

  1. does not disable caching for these cookies
  2. varies the cached responses by the value of these cookies

Together that means that Varnish will happily cache personalized responses, and will serve the correct personalized response. For more information, see https://www.drupal.org/developing/api/8/cache/tags/varnish

Supporting organizations: 
Acquia provided the opportunity and my time for creating this module, as well as the team to review and help with it.

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • Created by rlnorthcutt on , updated