# Reviews Badge Widget

## Overview

An authoritative trust-mark that builds social proof and establishes credibility in the minds of prospective shoppers, the Reviews Badge shows the total number of published reviews and the aggregated average of all star ratings.

<div><figure><img src="https://317471629-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKeDY1gVsPqUlb1dtZzTr%2Fuploads%2FtMgNlI7Wzsp3m0Tg8Uzk%2Freviews-badge-3.png?alt=media&#x26;token=841f5733-4697-41b8-85c2-0b82d355ad08" alt=""><figcaption></figcaption></figure> <figure><img src="https://317471629-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKeDY1gVsPqUlb1dtZzTr%2Fuploads%2Fq7vOfOu92TMJ0Obd0GB0%2Freviews-badge-2.png?alt=media&#x26;token=feddc141-9f0b-4b43-b368-0696b83ddec9" alt=""><figcaption></figcaption></figure> <figure><img src="https://317471629-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKeDY1gVsPqUlb1dtZzTr%2Fuploads%2FK9x1rXZYPx4gRMDnwbq8%2Freviews-badge-1.png?alt=media&#x26;token=d0020e0a-c9b3-4601-adf3-f6c1447d3641" alt=""><figcaption></figcaption></figure></div>

## Installation

{% tabs %}
{% tab title="Shopify Online Store 2.0" %}
Instructions for a Shopify Online Store 2.0 installation can be found [here](https://support.okendo.io/en/articles/5537298-installing-okendo-on-shopify-online-store-2-0).
{% endtab %}

{% tab title="Shopify Vintage Theme" %}

1. Create a new liquid snippet in the snippets folder with the following name: `snippets/okendo-reviews-badge.liquid`
2. Inside your newly created liquid file, add the following HTML snippet:

   ```tsx
   <div data-oke-badge></div>
   ```
3. Customize your snippet with the data attributes listed [here](#reviews-badge-widget-data-attributes).
4. Copy the following snippet and place it in your Theme Code where you would like the widget to appear: `{% render 'okendo-reviews-badge' %}`
   {% endtab %}
   {% endtabs %}

## Styling

The preferred method of configuring the Reviews Badge is via the Okendo Admin which can be accessed in the Okendo app via Reviews -> On-Site Displays:

<figure><img src="https://317471629-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKeDY1gVsPqUlb1dtZzTr%2Fuploads%2F5ebxcNc3mK4xVkHvt3ru%2Fon-site-displays-1.jpg?alt=media&#x26;token=22388cfc-7101-4bc5-875f-ed0baa58d660" alt=""><figcaption></figcaption></figure>

## Data Attributes

| Data Attribute                | Description                                                                                                                                                            | Value Type | Supported Values                                                                        | Required |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------- | :------: |
| `data-oke-reviews-product-id` | Used to specify a Shopify Product ID with the word `shopify-` in front of it. The reviews badge widget will only show aggregate review data for the specified product. | `string`   | Any valid product ID in the format `shopify-` e.g. `shopify-1234567`.                   |          |
| `data-oke-reviews-group-id`   | Used to specify an Okendo Group ID so that the reviews badge widget will only show aggregate review data for the specified group of products.                          | `string`   | Any valid product group ID in a GUID format e.g. `69d2e67d-b980-4333-97b7-30411807a7b1` |          |
| `data-oke-url`                | Used to hyperlink the badge on click so that it directs the user to a custom absolute URL.                                                                             | `string`   |                                                                                         |          |

## Examples

### **Giving The Widget A Data Source**

Without specifying a data source for the media, the widget will show **all** media for your store. You can provide either a Product ID or a Group ID to use that as the data source for the media.

#### **Product Widget**

If you are using **liquid** use the following snippet:

```html
<div data-oke-carousel data-oke-reviews-product-id="shopify-{{ product.id }}"></div>
```

The general format for other frameworks is:

```markup
<div data-oke-carousel data-oke-reviews-product-id="shopify-<PRODUCT_ID>"></div>
```

#### **Group Widget**

Learn more about Okendo Groups here:

{% embed url="<https://support.okendo.io/en/articles/3086139-understanding-okendo-groups>" %}

If you are using **liquid or general frameworks** use the following snippet:

```html
<div data-oke-carousel data-oke-reviews-group-id="<GROUP_ID>"></div>
```

Group ID is found in the Okendo Admin URL for a given group as descibed in the table above.
