Clean up existing implementations of Ratings & Reviews
If Bazaarvoice code is currently integrated on your site, ensure that the new BV loader framework works properly by following these steps:
-
Make sure no
<script>tags or dynamic scripts referencebvapi.js. -
Remove any of the following attributes:
- id="BVRRSummaryContainer"
- id="BVRRContainer"
- id="BVQAContainer"
-
Remove any code that relies on
$BV, such as calls to$BV.configureor$BV.ui. -
If Bazaarvoice SEO is implemented, update the implementation to remove references to BVRRSummaryContainer, BVRRContainer, BVQAContainer, and
$BVcalls. The SEO implementation must now reference the<div>tags described in Add Bazaarvoice code to your site.
bvCallback function and then add any $BV.configure or $BV.ui calls specific to those features in that function.
Single-page application support
If your site is a single-page application (SPA), the BV loader is fully supported.
Our MutationObserver monitors your site's HTML containers with the bv-data-show attribute. Once a Bazaarvoice container is on the page and registered, if any of your scripts update the data-bv-product-id, data-bv-subject-id, or any other data property recognized by our API, the BV loader will handle the rest by:
- Reinitializing any namespaces
- Fetching API data from the browser cache or the web
- Redrawing any applications within the new page setup
For example, call the following methods to dynamically set attributes in containers with bv-data-show:
document.querySelector('[data-bv-show="reviews"]').setAttribute('data-bv-product-id', 'product2');
document.querySelector('[data-bv-show="rating_summary"]').setAttribute('data-bv-product-id', 'product2');