Title: Loyalty.js
Author: eisenivan
Published: <strong>October 28, 2014</strong>
Last modified: January 26, 2015

---

Search plugins

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.

![](https://s.w.org/plugins/geopattern-icon/loyaltyjs.svg)

# Loyalty.js

 By [eisenivan](https://profiles.wordpress.org/eisenivan/)

[Download](https://downloads.wordpress.org/plugin/loyaltyjs.2.0.2.zip)

 * [Details](https://wordpress.org/plugins/loyaltyjs/#description)
 * [Reviews](https://wordpress.org/plugins/loyaltyjs/#reviews)
 *  [Installation](https://wordpress.org/plugins/loyaltyjs/#installation)
 * [Development](https://wordpress.org/plugins/loyaltyjs/#developers)

 [Support](https://wordpress.org/support/plugin/loyaltyjs/)

## Description

**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. https://github.com/eisenivan/loyalty

## Installation

 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.

## FAQ

#### 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.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

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

Contributors

 *   [ eisenivan ](https://profiles.wordpress.org/eisenivan/)

[Translate “Loyalty.js” into your language.](https://translate.wordpress.org/projects/wp-plugins/loyaltyjs)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/loyaltyjs/), check 
out the [SVN repository](https://plugins.svn.wordpress.org/loyaltyjs/), or subscribe
to the [development log](https://plugins.trac.wordpress.org/log/loyaltyjs/) by [RSS](https://plugins.trac.wordpress.org/log/loyaltyjs/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 2.0.2

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

#### 2.0.1

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

#### 2.0.0

 * 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…

#### 1.1.0.0

 * Added shortcode to display the current number of loyalty views

#### 1.0.0.0

 * Hello world!!! The initial release

## Meta

 *  Version **2.0.2**
 *  Last updated **11 years ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 3.0.1 or higher **
 *  Tested up to **4.1.42**
 * Tags
 * [customer loyalty](https://wordpress.org/plugins/tags/customer-loyalty/)[jquery](https://wordpress.org/plugins/tags/jquery/)
   [Loyalty](https://wordpress.org/plugins/tags/loyalty/)[view count](https://wordpress.org/plugins/tags/view-count/)
 *  [Advanced View](https://wordpress.org/plugins/loyaltyjs/advanced/)

## Ratings

 5 out of 5 stars.

 *  [  4 5-star reviews     ](https://wordpress.org/support/plugin/loyaltyjs/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/loyaltyjs/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/loyaltyjs/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/loyaltyjs/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/loyaltyjs/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/loyaltyjs/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/loyaltyjs/reviews/)

## Contributors

 *   [ eisenivan ](https://profiles.wordpress.org/eisenivan/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/loyaltyjs/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](https://github.com/eisenivan/loyalty)