Embedding GreenScore radial widget for Product Page


The GreenScore radial is a visual component that displays the GreenScore of a product. The GreenScore rating reflects a food product's health and sustainability impacts. Products are rated following four science-based industry standards for: nutritional value, food processing, ingredient safety, and climate footprint, on a scale of 1-100. These four category ratings make up a products GreenScore.

GreenScore Radial


Before embedding the GreenScore radial widget, you may want to generate a demo GreenScore radial for your product to understand how it works. To do this, follow these steps:

  1. Visit the GreenScore Radial website.

  2. On the generator page, you will see the query param in the URL for the product's UPC. For demo, you can use sample UPC89836026095.

  3. Enter the UPC along with radialSize in the URL and load the page. Radial size can be sm=small, md=medium or lg=large.

  4. There is also an option to turn on/off the label along with radial and for that, the true attribute will be used e.g. label=true

  5. A new GreenScore radial for the specified UPC and size will be generated.


Before embedding the GreenScore radial widget, ensure that you have the following:

  1. A product's UPC (Universal Product Code) to generate the GreenScore radial.
  2. Radial size of your choice sm, md or lg
  3. Choose true for the label option if required
  4. Access to the GreenScore radial widget integration code.

Embedding the GreenScore Chart Widget

To embed the GreenScore radial widget on your product page, follow these steps:

Step 1: Get Your Product's UPC

To display the GreenScore radial, you'll need to provide your product's UPC.

Step 2: Include the Widget HTML

 <iframe id="gs-radial" frameborder="0" loading="eager"></iframe>

Step 3: Add basic CSS for the iframe

#gs-radial {
    width: 100px;
    padding: 0 10px;
    height: 100px;

Step 4: Add script to load iframe src

// Assuming UPC is available in the URL
   function r() {
        function q(n) {
          const p = new URLSearchParams(location.search);
          return p.get(n);
        const r = q("radialSize");
        const n = q("upcCode");
        const l = q("label");
        if (r) {
          const i = document.getElementById("gs-radial");
          const u = "https://widgets.gcpbc.co/getRadial?upcCode=";
           const f = u + n + "&radialSize=" + r + "&label=" + l;
          i.src = f;

Or else get the UPC dynamically and send it to iframe src along with radial size and label option

 <iframe src={`https://widgets.gcpbc.co/getRadial?upcCode=${upcCode}&radialSize=md&label=true`} id="gs-radial" frameborder="0" loading="eager"></iframe>

Step 5: Provide custom styling for the iframe as per your website layout