Skip to content

Instantly share code, notes, and snippets.

@charleshimmer
Last active August 14, 2020 12:48
Show Gist options
  • Select an option

  • Save charleshimmer/5134440 to your computer and use it in GitHub Desktop.

Select an option

Save charleshimmer/5134440 to your computer and use it in GitHub Desktop.
Inline Ratings (multiple product rating stars on one page)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Meat and Potatoes of BV Integration Code-->
<script src="//display-stg.ugc.bazaarvoice.com/static/ClientName/bvapi.js"></script>
<script>
$BV.ui( 'rr', 'inline_ratings', {
productIds : ['product-id-1', 'product-id-2', 'product-id-3', 'product-id-4'],
containerPrefix : 'BVRRInlineRating'
});
</script>
</head>
<body>
<h1>Inline Rating integration code demo</h1>
<!-- Contents of this div will be the star rating for product-id-1. Can optionally display the average rating and number of reviews. -->
<div id="BVRRInlineRating-product-id-1"></div>
<!-- Contents of this div will be the star rating for product-id-2. Can optionally display the average rating and number of reviews. -->
<div id="BVRRInlineRating-product-id-2"></div>
<!-- Contents of this div will be the star rating for product-id-3. Can optionally display the average rating and number of reviews. -->
<div id="BVRRInlineRating-product-id-3"></div>
<!-- Contents of this div will be the star rating for product-id-4. Can optionally display the average rating and number of reviews. -->
<div id="BVRRInlineRating-product-id-4"></div>
</body>
</html>
@cricex
Copy link

cricex commented Mar 21, 2014

Thanks for this, makes up for BV's terrible documentation. For what it's worth I had to wrap the productids in single quotes where the URLs are defined.

@tbrodeen
Copy link

Great job, thanks for sharing!

@markadrake
Copy link

Thanks - I too found BV's documentation lacking.

Do you know if he default configuration can be overridden here? For example: the default may be to show inline ratings WITH the average score in parentheses. Can we set a config option to hide it on a particular instance or page?

@kermitsxb
Copy link

Thanks for sharing !

@xdoctordog
Copy link

thanks for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment