Integrate UGC into your website

Implementing the Bazaarvoice loader,  also known as the BV loader (bv.js), is the essential first step to displaying high-converting user-generated content (UGC) directly on your site.

By adding this single, lightweight script (bv.js) to your pages, you immediately unlock the power of ratings, reviews, and review highlights that guide your consumers' purchasing decisions.

Verify your current configuration before starting. If your implementation relies on the legacy bvapi.js scout file, refer to the display integration v1 documentation.


 Benefits of using the bv.js loader

  • Boosts sales: Embed star ratings and consumer reviews directly into your product pages to build buyer confidence and lower cart abandonment.
  • One-time setup: Your IT team embeds the BV loader script bv.js and the feature display containers during initial setup. After that, you can customize the hosted UCG displays in Portal.
  • Fast page speeds: It loads quietly in the background without slowing down your site, keeping your consumer experience smooth and protecting search engine rankings. 


What your consumers see

Each Bazaarvoice feature appears on your pages in a display container. The following table shows what consumers see and where each feature appears:

Feature display What consumers see Where it appears
Rating summary A summary of the ratings for a product. Product display page (PDP), as close to the product name and image as possible.
Review Highlights A high-level summary of positive, neutral, and negative ratings and reviews. PDP, below the product image.
Reviews A list of ratings and reviews from each consumer who submitted a review. PDP, lower on the page.
Questions & Answers Questions and answers provided by consumers. PDP, below the main review display.
Inline ratings A summary of ratings for each product in a list. Product listing or category pages, product recommendation carousels, and search results pages, below the product name.
Seller Ratings Up to 12 four- and five-star reviews, refreshed daily. Home page, lower on the page.
Reviews Collect Rating stars that let consumers review each product they purchased. Order History page.

For a technical explanation of how the loader displays these features, refer to How the Bazaarvoice loader works.


Hand off to your IT team

Your technical team handles the site code, while you configure the display settings in the Portal.

  • IT handle the code. Ask your developer to add the BV loader script (bv.js) to the <head> of each page, and then add a display container (<div>) for each feature you want to show. For details, refer to Step 1: Add Bazaarvoice code.
  • You configure how content looks in the Portal. After the code is on your site, customize how content is displayed. For details, refer to Hosted display configuration.

Give your developer the following information: your client name, deployment zone ID, environment (staging or production), and locale.


Step 1: Add Bazaarvoice code (bv.js) to your site

To display ratings, reviews, and other consumer-generated content, add the Bazaarvoice loader script to your web pages. This lightweight, asynchronous JavaScript application loads only the specific features required for each page, ensuring optimal site performance.

To use AI features such as AI Review Summary, you must contact Bazaarvoice Support to enable them for your account. The corresponding bv.js code will remain inactive until these features are enabled on the backend.

To add the BV loader script, add the following to your HTML within the <head> tag of the page:

Code
   <script async src="https://apps.bazaarvoice.com/deployments/<client_name>/<site_ID>/<environment>/<locale>/bv.js"></script>

where:

Parameter Required Example / Value Description
src Required https://apps.bazaarvoice.com/deployments/<client_name>/<site_ID>/<environment>/<locale>/bv.js The script source URL containing your specific configuration variables. Replace each element in angle brackets with the values described in this table.
async Optional
(Recommended)
None (boolean flag) Loads the script asynchronously to prevent blocking page render.
<client_name> Required acme Your assigned Bazaarvoice client name. Must be lowercase.
<site_ID> Required main_site The ID of the deployment zone you want to use, set in the Bazaarvoice Portal Site Manager. The default deployment zone is main_site. Check with your Bazaarvoice representative to confirm the correct ID, or select Icon to find the deployment zone ID to the right of the deployment zone on the Site Manager page.
<environment> Required staging or production Use staging for test/QA sites. Use production for your live site.
<locale> Required en_US The target display locale in language_REGION format (for example, en_GB, fr_FR).


Tip: If you've already added the Bazaarvoice loader script (bv.js) for BV Pixel or Dynamic Catalog Collection (DCC), do not include it again. The bv.js script must only be loaded once per page.



Step 2: Add display containers for each UGC feature

Add code to the <body> of a page where UGC features should be displayed. If you're unfamiliar with data attributes, refer to the Using Data AttributesOpens in new tab page.


The following table lists the data-bv-show value and recommended placement for each feature:

UCG feature Page type data-bv-show value Recommended placement
Rating summary PDP rating_summary Above the fold
Review Highlights PDP review_highlights Below the product image
Reviews PDP reviews Below the fold
Questions & Answers PDP questions Below reviews
Inline ratings Category, search, carousel inline_rating Below the product name
Seller Ratings Home page seller_ratings Below the fold
Reviews Collect Order History See Reviews Collect n/a


Note: After you add code to your site, customize how content is displayed on your pages as described in Hosted display configuration.
Shadow DOM: If your web page uses a shadow Document Object Model, you can integrate ratings, reviews, and questions and answers applications inside it. For details, refer to the shadow DOM integration.


Rating summary

Rating summary displays a summary of information about the specified product ID.

  • Location: We recommend placing rating summary above the fold, as close to the product name and image as possible on your product display pages (PDPs).

  • Required HTML code for this feature:

    <div data-bv-show="rating_summary" data-bv-product-id="ExternalId"></div>
    

    The data-bv-show data attribute instructs the BV loader to display the rating summary, and data-bv-product-id instructs the BV loader to display the feature for a specified product ID, which must match the ExternalId provided in the product catalog.

    If you want to display multiple rating summaries for the same product on a PDP, add the data-bv-seo="false" data attribute to subsequent rating summary <div> tags. This ensures that schema.org metadata is rendered for the first rating summary only. If schema.org metadata is rendered for more than one rating summary on a page, it interferes with the page's SEO. Here is an example:

    <div data-bv-show="rating_summary" data-bv-product-id="ExternalId"></div>
    ...
    <div data-bv-show="rating_summary" data-bv-product-id="ExternalId" data-bv-seo="false"></div>
    

Only use rating summary for one product on each page. You can have more than one rating summary on each page, but they must all be for the same product. To show multiple rating summaries for multiple products on a single page, such as on a category listing page, use inline ratings instead.


Reviews

Reviews displays a list of ratings and reviews from each consumer who submitted a review.

  • Location: We recommend placing reviews below the fold, lower on your product display pages (PDPs).
    Caution: We don't recommend placing reviews behind a tab. If your reviews will be displayed behind a tab, refer to Show hidden content.
  • Required HTML code for this feature (recommended):

    <div data-bv-show="reviews" data-bv-product-id="ExternalId"></div>
    

    The data-bv-show data attribute instructs the BV loader to display reviews, and data-bv-product-id instructs the BV loader to display the feature for a specified product ID, which must match the ExternalId provided in the product catalog.

    If you previously used $Bv.ui and are moving to Bv.ui, use the following HTML code:

JavaScript
BV.ui("show_reviews", {
  productID: "productID",
  contentContainerDiv: 'id or reference of the element to render reviews in.'
});

The following example shows the three parameters required to trigger this event:

JavaScript
$BV.ui("rr", "show_reviews", {
  productId: "productID"
});

Required parameters

The following table identifies the required parameters/fields:

Parameter Description
rr Required string parameter.
show_reviews Required string parameter.
productId ID or DOM (Document Object Model) element associated with the v2 Ratings & Reviews application.
contentContainerDiv ID or DOM element that identifies the div element associated with the v2 Ratings & Reviews application.

Optional parameters

Parameter Description
doShowContent Function called to prevent the content hidden behind a tab or other UI elements.
summaryContainerDiv To enable SEO for v2 Ratings & Reviews or add data-bv-seo attribute. By default, set to false.


Questions & Answers

Questions & Answers shows questions and answers provided by consumers for the specified product ID.

  • Location: We recommend placing Questions & Answers below the main review display, lower on the PDP.

  • Required HTML code for this feature:

    <div data-bv-show="questions" data-bv-product-id="ExternalId"></div>
    

    The data-bv-show data attribute instructs the BV loader to display Questions & Answers, and data-bv-product-id instructs the BV loader to display the feature for a specified product ID, which must match the ExternalId provided in the product catalog.


Review Highlights

Review Highlights shows a high-level summary of positive, neutral, and negative ratings and reviews.

  • Location: We recommend placing review highlights below the product image (above the fold, if possible, or right below the fold) so consumers can see this as they scroll the page for product information.

  • Required HTML code for this feature (recommended):

    <div data-bv-show="review_highlights" data-bv-product-id="ExternalId"></div>
    

    The data-bv-show data attribute instructs the BV loader to display review highlights, and data-bv-product-id instructs the BV loader to display the feature for a specified product ID, which must match the ExternalId provided in the product catalog.

    If you previously used $Bv.ui and are moving to Bv.ui, use the following HTML code:


Reviews Collect

Reviews Collect displays the rating stars on the Order History page of your website, allowing consumers to review each product purchased.


Inline ratings

You can display inline ratings on a product listing or category page, product recommendation carousel, or search results page to provide a summary of ratings for products or services. The code for inline ratings is executed only once for each page, regardless of how many pages you display.

  • Location: We recommend placing inline ratings below the product name on the product listing, product recommendation carousel, or search results page.

  • Required HTML code for this feature:

<div data-bv-show="inline_rating" data-bv-product-id="ExternalId-1"></div>
<div data-bv-show="inline_rating" data-bv-product-id="ExternalId-2"></div>

The data-bv-show data attribute instructs the BV loader to display inline ratings, and data-bv-product-id instructs the BV loader to display the feature for a specified product ID, which must match the ExternalId provided in the product catalog.

If you want to include a hyperlink in an inline rating, add the data-bv-redirect-url="<http://mycompany.com/product1>" data attribute to the inline rating <div> tag.


Seller Ratings

Seller Ratings displays up to 12 four- and five-star reviews on your home page, which are refreshed daily. It also enables your seller ratings to appear in inline search results.

  • Location: We recommend placing Seller Ratings below the fold on your home page.

  • Required HTML code for this feature:

    <div data-bv-show="seller_ratings"></div>
    

    The data-bv-show data attribute instructs the BV loader to display Seller Ratings for the client that matches the <client_name> provided in the header <script> tag. Note that Google Seller Ratings must be enabled for at least 24 hours before the feature appears on your site.


How the Bazaarvoice loader works

The Bazaarvoice loader (bv.js) uses a lightweight, asynchronous lifecycle to render UGC without slowing down your page-load speeds.

  1. Browser page request: A consumer or search crawler visits a product detail page (PDP).
  2. Initial server response: Your server delivers the raw HTML document containing placeholder <div> containers (for example, <div data-bv-show="reviews" data-bv-product-id="<ExternalId>"></div>) mapped to your product catalog's ExternalId.
  3. Asynchronous script download: The browser reads the <head> tag and initiates the bv.js download from the Bazaarvoice CDN. The async attribute ensures the browser continues rendering your layout, fonts, and images without script blocking.
  4. DOM scanning: Once downloaded, bv.js automatically scans the HTML structure to locate active Bazaarvoice data attributes (data-bv-show) and their corresponding product IDs. To render Bazaarvoice UGC content inside a shadow DOM, refer to shadow DOM.
  5. UGC injection: The script fetches your approved display configurations and dynamically injects interactive UI components, including rating summaries, reviews accordions, and review highlights, directly into your display containers.
The loader is page-aware, downloading only the assets needed for containers present on the page. For example, if it detects only an inline_rating container on a category grid, it skips the heavier review display scripts. 


Full code example

The following example contains most of the code you must add to each PDP. Use this code as a reference; do not copy and paste this code without adding your company's specific information. You must modify this code to support your implementation and place each code snippet in the appropriate location in each page's HTML.

HTML
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Download the BV loader file. In the URL, replace <client_name>, <site_ID>,
         and <locale>, and replace <environment> with 'staging' or 'production'. -->
    <script async src="https://apps.bazaarvoice.com/deployments/<client_name>/<site_ID>/<environment>/<locale>/bv.js"></script>
  </head>

  <body>
    <!-- Rating summary: above the fold, near the product name or image -->
    <div data-bv-show="rating_summary" data-bv-product-id="productID123"></div>

    <!-- Review Highlights: below the product image -->
    <div data-bv-show="review_highlights" data-bv-product-id="productID123"></div>

    <!-- Reviews: below the fold -->
    <div data-bv-show="reviews" data-bv-product-id="productID123"></div>

    <!-- Questions & Answers: below reviews -->
    <div data-bv-show="questions" data-bv-product-id="productID123"></div>
  </body>
</html>


Show hidden content

Some user actions cause Bazaarvoice features to come into view, such as selecting the ★★★★★ icons in the rating summary, which scrolls to ratings and reviews. Tabbed navigation has become very common in recent years.

Search engines are capable of effectively indexing content that resides behind a tab, provided the following two conditions are met:

  1. The SEO content is present in the initial HTML format of the page and is not loaded through scripts on your side.
  2. The SEO content is visible on the page even after you turn off JavaScript in your browser and refresh the page.
Note: If the default state of the container that holds the SEO content is set to "visibility: hidden" or "display: none", then:
  • Use JavaScript to reset this property. Do not declare this property in a stylesheet or inline to the element.
  • Apply to all tabs so that all content is visible when the page is displayed with JavaScript off.

Example code

Here is an example of the JavaScript code that can be used to hide the tab content:

HTML
<script type="text/javascript">
    document.getElementById('tab1').style.display = 'none';
    document.getElementById('tab2').style.display = 'none';
    document.getElementById('tab3').style.display = 'none';
    document.getElementById('tab4').style.display = 'none';
</script>

You can also style directly in the div if this content is hidden behind a tab. However, you must add custom, page-specific code that calls the bvCallback function to show the correct tab or container.

Add the bvCallback function to the page so that the BV loader can download and execute it when the BV loader is downloaded (asynchronously). Then, include code in the bvCallback function to run a custom function.

Example code for v1 implementations

You can include a callback to the show event using the BV.reviews.on method when reviews come into view. (The BV.questions.on method is also available.) This example uses the bootstrap tab component:

HTML
<!DOCTYPE html>
<html lang="en">
  <head>
      <!-- Download the BV loader file. This replaces bvapi.js in Ratings & Reviews v1 implementations.
        In the URL, replace <client_name>, <site_ID>, and <locale>, and replace <environment> with 'staging' or 'production'.
      -->
      <script async src="https://apps.bazaarvoice.com/deployments/<client_name>/<site_ID>/<environment>/<locale>/bv.js"></script>
  </head>

  <body>
          <!-- Rating summary goes above the fold near product name or image -->
          <div data-bv-show="rating_summary" data-bv-product-id="ProductID123"></div>

          <!-- Content Tabs -->
          <div id="review_tab" style="display: none;">
            <!-- Instruct BV loader to show the R&R feature for productID123 here -->
            <div data-bv-show="reviews" data-bv-product-id="productID123"></div>
          </div>

          <div id="questions_tab" style="display: none;">
            <!-- Instruct BV loader to show the Q&A feature for productID123 here -->
            <div data-bv-show="questions" data-bv-product-id="productID123"></div>
          </div>

          <script>
            // bvCallback must be used when interacting with BV via JavaScript and using the `async` attribute. 
            window.bvCallback = function (BV) {

          // Register a function to be called when a BV feature needs to display the R&R element, such as Rating Summary's stars
              BV.reviews.on('show', function () {
                 // If the R&R container is hidden (such as behind a tab), put code here to make it visible (open the tab)
                 $('#review_tab').show();
              });

          // Register a function to be called when a BV feature needs to 
          // display the Q&A element, such as when selecting the number of questions link
              BV.questions.on('show', function () {
                // If the container is hidden (such as behind a tab), put code here to make it visible (open the tab) 
                $('#questions_tab').show();
              });
            };
          </script>
  </body>
</html>

Example code for v2 implementations

You can include a callback to the show event using the BV.swat_reviews.on method for reviews. Use the BV.swat_questions.on method when questions come into view. The following example uses the bootstrap tab component:

HTML
<!DOCTYPE html>
<html lang="en">
  <head>
      <!-- Download the BV loader file. This replaces bvapi.js in Ratings & Reviews v1 implementations.
        In the URL, replace <client_name>, <site_ID>, and <locale>, and replace <environment> with 'staging' or 'production'.
      -->
      <script async src="https://apps.bazaarvoice.com/deployments/<client_name>/<site_ID>/<environment>/<locale>/bv.js"></script>
  </head>

  <body>
          <!-- Rating summary goes above the fold near product name or image -->
          <div data-bv-show="rating_summary" data-bv-product-id="ProductID123"></div>

          <!-- Content Tabs -->
          <div id="review_tab" style="display: none;">
            <!-- Instruct BV loader to show the R&R feature for productID123 here -->
            <div data-bv-show="reviews" data-bv-product-id="productID123"></div>
          </div>

          <div id="questions_tab" style="display: none;">

           <!-- Instruct BV loader to show the Q&A feature for productID123 here -->

           <div data-bv-show="questions" data-bv-product-id="productID123"></div>

         </div>

          <script>
            // bvCallback must be used when interacting with BV via JavaScript and using the `async` attribute. 
            window.bvCallback = function (BV) {

          // Register a function to be called when a BV feature needs to display the R&R element, such as Rating Summary's stars
              BV.swat_reviews.on('show', function () {
                 // If the R&R container is hidden (such as behind a tab), put code here to make it visible (open the tab)
                 $('#review_tab').show();
              });
               
          // Register a function to be called when a BV feature needs to display the Q&A element, such as when selecting the number of questions link

         BV.swat_questions.on('show', function () {

                // If the Q&A container is hidden (such as behind a tab), put code here to make it visible (open the tab) 

               $('#questions_tab').show();
         });
            };
          </script>
  </body>
</html>


Render v2 applications with shadow DOM

If you have implemented a shadow Document Object Model (DOM) on your web page, you can integrate the hosted display v2 applications (Ratings & Reviews and Questions & Answers) inside it. To integrate these applications when you configure the PDP display:

  1. Sign in to the Bazaarvoice PortalOpens in new tab.
  2. From the upper-right corner, select the settings icon settings icon.
  3. Under Configuration, select Ratings & Reviews. The Site Manager lists all your active deployment zones and implementations. 
  4. Under Implementations, select Edit next to the implementation you want to configure.
  5. In the User Experience section, select Display Options.
  6. To configure settings common to Ratings & Reviews and Questions & Answers, select the Global Configuration tab.
  7. Select Enabled under Render V2 applications within shadow DOM.
  • Enabling shadow DOM prevents you from applying custom overrides to CSS files.
  • If you want to integrate v2 applications within the shadow DOM and inject them later instead of on page load, you must call the BV API BV.registerMutationObserver() to ensure a seamless integration.


Provide feedback button