Star Rating Widget API

To install single rating widget on your website you need to copy and past widget code where you want to display the rating.

The standard rating widget code is as follows:


  • SITE_ID - your site ID

To get this widget code Sign Up and registered your site then go to menu Rating - Install.
Also you can set method of voting at Rating - Setting menu. Available voting methods: Social, IP, Browser (Cookie).

Several ratings on the same page

To install several rating widgets on the same page you need to add wpac-rating class to each root DOM elements and data-wpac-chan attribute to definition the channel to link ratings with your web content (page, photo, product, etc...). For example place four rating widgets:

Run example:

Using on AJAX sites

Rating widget can initialize dynamically using the WPac.init({...}) function.

Run example:

Customization: HTML template

To change default HTML template of rating widget add html parameter to wpac_init var. Default HTML template is:
{{?it.count>0}}{{=it.rating}}{{?}} {{=it.stars}} {{?it.count>0}}{{=it.count}} {{=it.votes}}{{?}}.
We use doT.js as template engine to more information look at doT.js manual.


  • rating - rating value (sum / count)
  • count - count of votes
  • stars - star icons
  • votes - localized vote(s) word

Examples for template {{=it.stars}} {{?it.count>0}}Rating: {{=it.rating}} based on {{=it.count}} votes{{?}}:

Run example:

Customization: stars, color, size

To change number of stars, color and star size add stars, color, size parameters to wpac_init var. Also instead wpac_init parameters you can use DOM element attributes: data-wpac-stars, data-wpac-color, data-wpac-size. DOM element attributes have a higher priority than wpac_init parameters.


Run example:

Your questions and feedbacks