Ajax Rating is a plugin for Movable Type that enables visitors to rate your entries or your blog.
Try it now by rating this blog:
The "Pro" version of Ajax Rating lets you rate comments, trackbacks, categories, authors, tags, and just about anything else. Added features include threshold viewing for comments based on rating, listing "hot" items, and comment reporting. More details on the Pro version below.
Ajax Rating is easy to setup and use. After downloading the plugin and installing the files, a few simple changes to your templates will enable you to adding Ajax Star Raters to your entries. For example, just add <MTAjaxStarRater type="entry"> to after the <MTEntryBody> tag and you are done - instant Ajax Star Ratings.
Membership required, please sign-in or register:
Ajax Rating Pro has a lot more features:
- Thumbs up /down (or plus/minus) rating modes
- Display listings of top rated items
- Rate comments and other objects
- Hide comments below a certain rating threshold
- Enable visitors to choose their own threshold
- Include a button for reporting spam or inappropriate comments
- Display "hot lists" based on recent voting activity
The "hot lists" feature mentioned above is one of the most powerful features of Ajax Rating. It can be used to enable Digg-like functionality, in which your home page can be set to display only the items that are "popular now". Used this way, the ratings become a filter for the content you feature on the home page. If you have a site or blog network with new entries be added frequently, this feature is especially useful. In a typical blog-format home page, entries get pushed lower down the page every time a new one is posted, so even popular entries can get pushed off the home page quickly on a busy site. Ajax Ratings gives you an alternative to this, displaying the hottest entries first, as determined by visitor rankings. This is automatic, and you can define the "hot" time frame (1 day, 3 days, 2 weeks, etc.). Ajax Rating hot lists can really change the dynamics of a site, and may inspire ideas for new ratings-driven sites.
Comment Viewing Threshold
Sites like Slashdot, Scoop-powered sites, and Digg have a similar feature, which hides comments if they are below a certain rating or score threshold. Referred to as a comment viewing threshold or a "collaborative filtering tool", the idea is to display top-rated comments prominently, while hiding or collapsing lower rated comments. With the Ajax Rating plugin, it is possible to do this with Movable Type comments. The plugin is very flexible in how you want to set this, but a common approach might be to enable readers to vote each comment "up" or "down" (plus or minus, thumbs up, thumbs down, etc.). A vote up would equal +1 point and a vote down would equal -1 point. You then set a default viewing threshold. For example, you might choose -10 as the default, meaning that comments with a total score of less than -10 will appear collapsed (or partially or completely hidden, you choose). Collapsed comments can be displayed with a single click. You can also include a form that enables readers to set their own threshold level. Again, this is very customizable, you decide how you want things to work on your site. Take a look at this test entry, which demonstrates both a Star Rater (for the entry) and Plus/Minus comment threshold viewing (for the comments). Set your own threshold using the form at the bottom of the comments and see how the display changes. Similar to the hot list described, above comment viewing thresholds are another way to transform the display of your content based on user ratings.
Another advanced feature is the ability to rate anything at all. In addition to rating MT objects like entries, comments, categories, authors, and blogs, you can also use Ajax Ratings to rate other things. For example, if you want to create a rater for a movie or book, you can do that. (Example: <$MTAjaxStarRater type="movie" id="23" max_points="5$> -- just remember what movie you assigned the ID 23 to....)
One Vote per IP Address
To prevent people from voting multiple times on the same item, only one vote is accepted per IP address per item.
Template tags for Ajax Rating are available for both static and dynamic (php) publishing.
The following template tags are available in Ajax Rating (free version):
- <MTAjaxStarRater> - This tag will output a star rater like the one shown above. To rate entries, it must be used in an Entry context (ie. between <MTEntries> and </MTEntries> tags or in the Individual Archive Template. A good spot is just after the <MTEntryBody> tag. The following arguments are supported:
- type - Recommend (but not required) when rating entries and required when rating a blog. (Example: <MTAjaxStarRater type="entry"> or <MTAjaxStarRater type="blog"). With Ajax Rating Pro, you can also specify the following types: comment, category, author, tag, trackback, or anything else (see "rate anything" above).
- max_points - Not required for entries and comments, but required for other types. This argument specifies the number of stars that will be displayed. (Example: <MTAjaxStarRater type="blog" max_points="5"> will create a rater with 5 stars)
- id - For advanced use, the id argument enables you specify a specific object ID number that you want to rate. If you use the tag in the correct context, you don't need to include the 'id' argument. But if you want to place a rater outside of the relevant context, or if you want to rate a non-MT object (see "rate anything" above), then you must specify the id of the object. Normally, you don't want to use this, so forget I mentioned it. ;)
- <MTAjaxRatingTotalScore> - This will display the total score for the item being rated (adding up the values of all of the ratings made).
- <MTAjaxRatingAverageScore> - This will display the average score for the item being rated.
- <MTAjaxRatingVoteCount> - This will display the number of votes or ratings that have been submitted for this item.
- <MTAjaxRatingEntryMax> - This will display the maximum number of points (stars) for rating entries, as specified in the plugin settings for that blog.
With Ajax Rating Pro, the following tags are also available (in addition to those described above):
- <MTAjaxRatingList> - A general purpose container tag for displaying listings of "top rated" items in the MT database. The following arguments are available:
- type - Required. Allowed values are: entry, comment, trackback, category, blog, author, tag. Tip: do not pluralize these types.
- sort_by - Determines which metric is use to rank the results. Allowed value are: average, votes, total. The default is sorting by total score.
- sort_order - The sort_order defaults to 'descend' (highest rating first), but you could also specify 'ascend' to show the worst rated items first.
- blogs - To display a list of items from all blogs on the system, specify blogs="all". Otherwise, leave this out and the list will be restricted to the current blog.
- show_n - Use this argument to specify the number of items you want to list (the default is 10). (Example: <MTAjaxRatingList type="entry" show_n="15">)
- hot - Set 'hot' equal to 1 to generate a list of recently "hot" items (this is the powerful feature discussed above). When the 'hot' argument is set to 0 or omitted, the listing will be based on "all time" ratings data. Adding hot="1" will based the listing on recent voting activity only.
- <MTAjaxRatingEntries> - Same as <MTAjaxRatingList type="entry">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
- <MTAjaxRatingComments> - Same as <MTAjaxRatingList type="comment">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
- <MTAjaxRatingPings> - Same as <MTAjaxRatingList type="trackback">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
- <MTAjaxRatingCategories> - Same as <MTAjaxRatingList type="category">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
- <MTAjaxRatingBlogs> - Same as <MTAjaxRatingList type="blog">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
- <MTAjaxRatingAuthors> - Same as <MTAjaxRatingList type="author">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
- <MTAjaxRatingTags> - Same as <MTAjaxRatingList type="tag">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
- <MTAjaxThumbRater> - Instead of a star rater, this tag will display a thumbs up/down (or plus/minus, etc.) rater. With this type of rater, there are images for voting an item "up" or "down". A vote "up" is equal to 1 point, a vote "down" is equal -1 point. The following arguments are available:
- type - Recommend (but not required when used in an entry or comment context). (Example: <MTAjaxThumbRater type="comment">). The same types can be used as described for <MTAjaxStarRater> above.
- id - Same (advanced) usage as described for <MTAjaxStarRater> above.
- report_icon - This optional argument will display a third button, a "report" button, when used with comment raters. Visitors to your site can click this button to report the comment (for abuse, spam, profanity, etc.). When a comment is reported, an email is sent to the author of that entry, along with a link to edit the comment in question.
- type - Recommended (but not required when used in an entry or comment context).
- id - Same (advanced) usage as described for <MTAjaxStarRater> above.
- <MTAjaxRatingCommentMax> - This will display the maximum number of points for rating comments, as specified in the plugin settings for that blog.
- <MTAjaxRatingDefaultThreshold> - This will display the default threshold for viewing comments, as specified in the plugin settings for that blog.
- <MTIfAjaxRatingBelowThreshold> - This is conditional tag whose contents will be displayed if the comment is below the default threshold, as specified in the settings. Note that this tag does not apply to user-specified thresholds (more on those later).
- <MTAjaxRatingRefreshHot> - WARNING: You should not use this tag if you have a busy site with high-volume voting activity. This a special tag, it displays no ouput. It simply triggers the process of calculating the list of "hot" items. Note that "hot" list are not tabulated when the listing tags are rebuilt. For performance reasons, this process happens separately, usually via an MT scheduled task that runs automatically (approx) once every hour. If, for some reason, you want to manually refresh to the "hot" list, you can place the <MTAjaxRatingRefreshHot> tag into an index template and rebuild it (be sure to uncheck the "rebuild this template with indexes" box!). Again, this should be used carefully on busy sites, and usually not at all. The "hot" list can also be refreshed via an included cron script (more on this later).
The settings for Ajax Ratings looks like this:
The blog settings for Ajax rating Pro looks like this:
Ajax Rating Pro also has a setting that is set only at the system level (Go to System Overview > Plugins). The system setting looks like this:
One of the notable settings is the "Rebuild After a Vote" option. High traffic site with high-volume voting should be careful with this setting. Generally speaking rebuilds can consume a lot of processor cycles, and a significant rebuilding after votes could slow things down, depending on several factors. The best performance option is "No Rebuilds" -- if you choose this option, the page will get update with the reader's vote immediately, but if this refresh the page, their vote won't be reflected (because the page has not yet been rebuilt). In this mode, ratings and votes counts get recorded into the database, but are not reflected on your pages until those pages are rebuilt (such as after a comment is posted to the entry, or manually rebuilt). If you have a site with high volume voting, chances are that you also have high-volume commenting -- if this is true, use the "No Rebuilds" option here and your entries will still be rebuilt every time a comment is posted. The second option here is "Rebuild Entry Only" -- this will only rebuild the Individual Archive template(s) for that entry (or if the vote is for a category, it will only rebuild the relevant category archive page) -- performance-wise, this option is not too bad. The third option is "Rebuild Entry, Archives, Indexes" -- this is the same level of rebuilding that happens when a comment is posted. It is the worst option performance-wise, as many pages may be rebuilt (the individual archive page(s), each of the category pages for the entries categories, any date-based archives enabled, and every index template in your blog. Be careful with this one on high-traffic blogs. The final option is "Build Indexes Only", which will only rebuild your index templates. This option might be suitable if you are only using the "Rate This Blog" widget (more on this later) on your main index. Note that if you are using PHP Dynamic publishing, there is no issue with rebuilds, you can set this to "No Rebuilds" and ratings will always be reflected correctly each time the page is loaded.
(Note: If you are running 3.3+, installation will be much easier, as the database tables will be automatically created for you. If you are running 3.2, you will need to create the tables manually - or via a utility like phpMyAdmin)
- Expand the zip file.
- Upload the contents of the 'plugins' directory to the 'plugins' directory of your MT install (usually /cgi-bin/mt/plugins)
- Upload the contents of the 'php' directory to the 'php' directory of your MT install (usually /cgi-bin/mt/php)
- Upload the contents of the 'mt-static' directory to the static directory created when you installed MT (usually called 'mt-static')
- Change the permissions on the mt-vote.cgi and mt-report.cgi (Pro only) files found within /plugins/AjaxRating/ to 755 (CHMOD 755)
- Login to Movable Type (or if already logged, click "Main Menu")
- If your are running MT 3.3+, you should now be redirected to an Upgrade screen that will install the tables for Ajax Rating. If you are running MT 3.2, then you need to create the tables manually, using the ajaxrating.sql file to create these tables.
- After the tables have been created, browse to the settings (Settings->Plugins) for the blog you want. Choose the settings that you want and then save.
- For every template for which you plan to place raters, add the following between the <head> and </head> tags:
- Now you can place raters to meet your needs. Most people may want to add something like the following below the <MTEntryBody> tag:
- Add the included Ajax Rating widget to your sidebar. This will display a "Rate this Blog" section that will enable people to rate your blog. (Optional)
- Test it out and tell people they can start submitting votes!
<link rel="stylesheet" href="<$MTBlogURL$>ajaxrating.css" type="text/css" />
Rating: <strong><span id="ajaxrating_entry_<$MTEntryID$>_avg"><$MTAjaxRatingAverageScore type="entry"$></span></strong>/<$MTAjaxRatingEntryMax$> (<span id="ajaxrating_entry_<$MTEntryID$>_cnt"><$MTAjaxRatingVoteCount type="entry"$></span> votes cast)
For more advanced usage, I am going to post a separate article soon, covering topics such as custom raters, comment threshold setup, customizing the star and plus/minus buttons, and more.
Get Ajax Rating
Ajax Rating is free for personal use, but you must include a link on your home page to http://mt-hacks.com/ajaxrating.html, such as:
Ratings on this site are powered by the <a href="http://mt-hacks.com/ajaxrating.html">Ajax Rating</a> plugin for Movable Type.
Membership required, please sign-in or register:
A lot of effort went into this plugin, donations are much appreciated. Suggested donation is $10:
If you wish to use Ajax Rating for commercial use, a commercial license must be purchased for $25:
Get Ajax Rating Pro
A regular license for Ajax Rating Pro enable you to use Ajax Rating Pro on up to 10 blogs on a single MT installation. The cost is $249:
If you want to use Ajax Rating Pro on more than 10 blogs on a single MT installation, you can purchase a "Blog Network License". The blog network license is for unlimited blogs on the same install, and includes up to 2 hours of implementation consulting and a custom multi-blog installation script. The multi-blog installation script can be customized to meet your needs (subject to the 2 hours of consulting time) and includes setup of settings and installation of templates for each blog. The blog network license is $499.
Rater Images and CSS Styles
I did not design the default star graphic used with this plugin, and I did not craft the CSS styles that make it look and work so slick. Much credit for both of these elements goes to Ryan Masuga of Masuga Design. Ryan's Unobtrusive AJAX Star Rating Bar has been downloaded more than 12,000 times! Thank you Ryan.
The plus / minus images, on the other hand, I did design .... and it shows. Graphic design is not my forte. As mentioned above, you can swap out your own images for both types of raters (more on that soon). If anyone out there want to design some better button images, please do! Thumbs up and thumbs down images would be cool, and maybe a better plus/minus set as well. If you design some buttons you want to share, let me know I will post them here or include them with Ajax Rating (giving you credit of course).
In the future Ajax Rating Pro will be enhanced even further. If you purchase a license for Ajax Rating Pro, you can help steer the development of new features. I see a lot of potential for this plugin with very active blog sites, and blog networks in particular -- and new features will likely be in this area. Here are a few ideas that may be worth adding if customers are interested:
- more sophisticated "hot" list algorithms - making this more sophisticated and customizable, so you can fine tune everything to make sure that the popularity filter is promoting those items that help build community and create buzz
- score summary for authors and commenters - look at which authors have the highest and lowesst rated entries (maybe offer prizes or compensation based on ratings), also look at summarized raters for each commenter, possibly triggering automatic or manual review when commenters have continually poor ratings (troll meter)
- displaying rating and vote information on the MT admin screens
- notification thresholds that will flag comments below thresholds, or even rules that automatically unpublish them pending review.
As always, comments, feedback, suggestions are welcome. Please reply to this entry.