This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.



What is Loyalty.js?

Loyalty js is a lightweight jQuery plugin that keeps track of how many times a user has come to your web property and allows you to craft a different experience based on that count. You can control the behavior by adding data-attribute tags to your DOM elements. Now, rather than having content rotate for every user at the same time, you will be able to “tell a story” that always starts at the beginning and progresses as a user becomes more engaged.

What does that mean?

Imagine you are a technology company with multiple project case studies on your site. As it stands now you can either…

1) Show your best case study first. This is great because people will see it first, but people that are returning to your site for the 3rd, 8th, 12th time still see it. Sure, you have calls to action that allow them to dig deeper and explore your content, but in essence, your landing page is no longer relevant to them. It is a wasted opportunity.

This leads people to…

2) Change up their content. They want to keep it “fresh”. The problem here is that a lot of people will come to your site that may never discover your favorite piece. Every user, regardless of how many times they have come see the same content. This feels like the equivilant of reading a story and forcing people that arrive late to join in the middle. What is “newest” is not always the most relevant way to introduce a first time visitor to your brand.

With loyalty.js you can dictate an experience that is based on how many times the user has visited your site, not an artificial timeline driven by “SEO Friendly Content Updates”.

WordPress Usage

This wordpress plugin comes complete with a shortcode that allows you to use loyalty.js tags in your content editor code. The shortcode is an enclosing tag.

[loyalty min=”3″ max=”4″]Your Content[/loyalty]

The plugin will honor min and max first. If you want the content to display at one specific view count, use ONLY the exact parameter.

[loyalty exact=”6″]This content will show on visit #6[/loyalty]

There is also a shortcode that allows you to print the number of views to the page. Simply add [loyalty_count] to your post content and Loyalty.js will render in a span tag with the css class of ‘loyaltyjs_count’ and the data-attribut ‘data-loyalty-count’. When it runs the plugin will fill in the integer value.

Advanced Implementation

If you would like to roll up your sleeves a little farther you can manually add data-attribute tage into your code. Please read the documentation on the GitHub page.


  1. Upload loyaltyjs to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Configure the loyalty.js in the admin console. Settings -> Loyalty.js
  4. Use the shortcode or add the data-attributes directly to your DOM elements to unleash the goodness.


Why is this cool?

This plugin is designed to make “storytelling” easier. The web is often boring, and each site offers the exact same experience to every user ever time. With this plugin you can define a different story for a user based on how many times they have visited. Maybe you want to show your “like us on facebook” call to action to users that have been to your site less than 10 times. After 10 visits though, they probably would have liked your page if they wanted to, so you can easily use that space to give them more useful information.


There are no reviews for this plugin.

Contributors & Developers

“Loyalty.js” is open source software. The following people have contributed to this plugin.

Translate “Loyalty.js” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.



  • Added ‘settings’ link to the Loyalty.js entry on the Admin plugins page


  • Fixed bug that casued a JS error when using the $ jQuery namespace


  • Updated to new version of Loyalty.js script. This fixes the issue of the loyalty count shortcode not rendering if there are no loyalty shortcode tags on the page.
  • Updated version a whole point in an effort to fix the versioning in the WordPress plugin distribution system. Fingers crossed…

  • Added shortcode to display the current number of loyalty views

  • Hello world!!! The initial release