Rating content for anonymous users with Mavention Anonymous Rating
Feedback through rating
When creating a solution you can never be sure about its success. Capturing feedback from your audience is an important asset in measuring how helpful and meaningful your solution is to them. Capturing feedback can be done in many ways. You can ask your users to fill in surveys, you can ask them to provide comments or you can ask them to rate your content. Which one you choose depends on your requirements and audience.
Rating in SharePoint 2010
One of the new capabilities in SharePoint 2010 is content rating. Out of the box SharePoint 2010 provides you with the rating capability that allows users to rate content on the scale of 1 to 5.
After activating content rating a new Rating field is added to the List. Using that field users can rate the content. A timer job running in the background ensures that all ratings are captured and calculated in the background introducing as little as possible performance penalty to your environment.
And while the standard rating mechanism is a great way to find out more about your content, it has one serious flaw. At this moment it doesn’t support rating by anonymous users.
What is Mavention Anonymous Rating?
Mavention Anonymous Rating is a solution created especially to provide the content rating capability for anonymous users on Internet-facing websites built on the SharePoint 2010 platform. Similarly to the standard rating capability provided with SharePoint 2010, it can be activated per List which allows you to control which content should be available for anonymous rating within your website.
Upon the deployment of the SharePoint Package two new Features are installed. One scoped to the Web Application, which deploys the Timer Job responsible for calculating ratings, and one scoped to the Site Collection which installs all the assets and allows you to enable anonymous rating on your lists.
After you enable both Features, you can start configuring anonymous rating on your site. For this go to the Pages Library Setting of the specific site and in the General Settings section click the Anonymous rating settings option.
To enable anonymous rating, in the Anonymous rating settings screen choose Yes (1) and click the OK (2) button.
After you do this, the rating columns will be added to the list and anonymous users will be able to rate your content. You can now start using rating.
Using Mavention Anonymous Rating
Mavention Anonymous Rating can be used in many different ways. Which one you choose depends on your requirements and the type of website you are working with.
Showing average rating
First of all there is the Rating Field Control that displays the current average rating of the current page. You can use it whenever you only want to display the rating without providing the ability to rate the content. The control uses the same User Experience as the standard SharePoint 2010 rating control. To use the Rating Field Control on your pages simply add the following code snippet to your Page Layout:
<%@ Register TagPrefix="Mavention" Namespace="Mavention.SharePoint.AnonymousRating.Controls" Assembly="Mavention.SharePoint.AnonymousRating, Version=126.96.36.199, Culture=neutral, PublicKeyToken=a43c589e76ba4e3d" %> <Mavention:RatingFieldControl FieldName="mvAverageRating" runat="server"/>
The Rating Field Control can not only be used by you to display the average ratings to your visitors but is also used in List Forms so that content authors can see the rating as well. While they can see the average rating, the control prevents them from editing it.
Rating content the basic way
The easiest way of using Mavention Anonymous Rating is with the Rating Basic Control.
Comparable to the Rating Field Control, the Rating Basic Control should be added to the Page Layout of Publishing Pages that you would like your visitors to rate. The main difference with the Rating Field Control is that the Rating Basic Control allows your visitors to rate the content.
The Rating Basic Control displays the current average rating as star images. Visitors can rate content using a rating form.
After submitting the rating, the page is reloaded and the form is hidden. As soon as the submitted rating has been calculated the new average rating will be displayed on the page.
Rating content the AJAX-y way
Depending on the requirements of your website, you might be using AJAX to provide richer User Experience. In such scenarios using the Rating AJAX Control might be a better choice.
The Rating AJAX Control enhances the Rating Basic Control with dynamic behavior. Instead of using radio buttons and postback to rate the page, it allows your visitors to click on the star images to submit their rating. This User Experience is very similar to the standard SharePoint 2010 rating.
After the user rates the page, an asynchronous call is made to the Anonymous Rating HTTP Handler and the rating is stored for processing by the Timer Job. At the same time the rating control becomes disabled so that the user cannot rate the same page multiple times.
Rating content on optimized sites
SharePoint 2010 is a platform for building web-based solutions. Because it’s a platform it’s up to you to tell it which components you want to load and which you don’t need. One way of optimizing Internet-facing websites built on the SharePoint 2010 platform is to exclude the form runat=”server” tag which minimizes the HTML markup generated by both SharePoint 2010 and ASP.NET and lowers the page’s footprint. Although this allows you to optimize your markup it requires you to build controls differently in order for them to work correctly.
Rating specific pages
In all the previous scenarios we assumed that you would allow your users to rate all pages of the specific type by including the rating control in the Page Layout. But what if you wanted to allow them to rate specific pages only?
To support such scenarios all controls we have just discussed have been wrapped with Web Parts what allows you to cherry-pick which pages should support rating by adding the Rating Web Part of your choice to those specific pages.
…and if we totally missed the boat…
Although we have put quite some effort in supporting different rating scenarios it might just happen that we don’t support yours. Does it mean Mavention Anonymous Rating isn’t for you?
Even if you can’t benefit from the standard rating controls, you can still use the Mavention Anonymous Rating API and provide your own rating UI. Depending on your requirements you can either call the HTTP Handler to submit ratings dynamically or you can communicate directly with the public API.
Integrating custom components in Internet-facing websites isn’t as easy as you might think. While you can anticipate integrating in a standard SharePoint 2010 site, making a custom component an integral part of a custom User Experience of an Internet-facing website can become very challenging.
After the rating
Mavention Anonymous Rating has been created particularly for anonymous users. One thing about anonymous users that makes it challenging for a rating component to work, is, that they are anonymous. Since you don’t have any information about the user it’s difficult to determine if he has rated the particular content already and if so to prevent him from rating it multiple times. Although there are many approaches of identifying anonymous users, each one of them has its pros and cons. Instead of deciding for you which one to use, Mavention Anonymous Rating gives you the ability to choose the mechanism that suits your needs the best yourself.
In its current version Mavention Anonymous Rating allows you to identify anonymous users either by cookie or by IP address. In the first case, the first time the user rates some content a cookie with a unique identifier is placed on his machine. Each time this user will come to a page that allows rating, a check will be made if the user has already rated this page or not. The downside of using cookies is, that as soon as the user clears his cookies, he can start rating your content all over again.
Another approach for identifying users is by their IP address. The first time the user rates some content, his IP address is stored. The next time he will visit a page that allows rating a check will be made if that specific IP address has already been used for rating content and therefore if the user should be allowed to rate the page. While it’s not that easy for users to change their IP address this approach might have undesired side effects especially if the majority of your users work at companies that have a single public IP address. In such scenarios only the first user is allowed to rate the content.
As you can see the choice is not easy and depends a lot on your requirements and the audience of your site. You can configure which approach you want to use using the Mavention Anonymous Rating configuration screen in Site Collection Setting.
The next step
As you can see Mavention Anonymous Rating is a complete solution that supports different scenarios. Although the initial requirement (allow anonymous users to rate content) sounds very easy, it isn’t, especially if you consider all the different challenges that integrating a custom rating component on an Internet-facing website introduces.
For this reason we have decided to release Mavention Anonymous Rating as a commercial product only. At this moment there is no free community version available. Don’t worry: it is not the beginning of a new trend. It’s just that particular solution that turned out to be that complex “just” to make it work.
I hope that I made you curious enough to consider using Mavention Anonymous Rating on your Internet-facing website built on the SharePoint 2010 platform.