Your shopping cart and checkout pages must be hosted on the same domain
The confirmation page must be hosted on your own domain
must be added to the top of every webpage
Once verified, follow the integration instructions to add the code snippet below to your order confirmation page and customize the variables as needed. The snippet integration will allow Google to display the Google Customer Reviews opt-in on your website.

window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { window.gapi.surveyoptin.render( { // REQUIRED FIELDS "merchant_id":11111 "order_id": "ORDER_ID", "email": "CUSTOMER_EMAIL", "delivery_country": "COUNTRY_CODE", "estimated_delivery_date": "YYYY-MM-DD", // OPTIONAL FIELDS "products": [{"gtin":"GTIN1"}, {"gtin":"GTIN2"}] }); }); }

Badge Integration
expand_less
Optional: Use the badge to display your participation in the Google Customer Reviews program as well as show your seller rating on your site.

To get started, add the code snippet below to any page on your site and customize the variables as needed. After the code snippet has been added, verify the badge and attached text appear as expected on your site. Note: If there aren’t any seller ratings available, the message "no rating available" will appear. Learn more

window.renderBadge = function() { var ratingBadgeContainer = document.createElement("div"); document.body.appendChild(ratingBadgeContainer); window.gapi.load('ratingbadge', function() { window.gapi.ratingbadge.render(ratingBadgeContainer, {"merchant_id": 11111}); }); }

Comments

Stealth created an issue. See original summary.

TR’s picture

Issue tags: -where would I insert this code ( where is the confirmation page?) what variables do I use in required fields

Please add code tags to your post so the code shows up correctly. See https://www.drupal.org/filter/tips

Stealth’s picture

<!-- BEGIN GCR Opt-in Module Code -->
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn"
  async defer>
</script>

<script>
  window.renderOptIn = function() { 
    window.gapi.load('surveyoptin', function() {
      window.gapi.surveyoptin.render(
        {
          // REQUIRED
          "merchant_id":"MERCHANT_ID",
          "order_id": "ORDER_ID",
          "email": "CUSTOMER_EMAIL",
          "delivery_country": "COUNTRY_CODE",
          "estimated_delivery_date": "YYYY-MM-DD",

          // OPTIONAL
          "opt_in_style": "OPT_IN_STYLE"
        }); 
     });
  }
</script>
<!-- END GCR Opt-in Module Code -->
<!-- BEGIN GCR Badge Code -->
<script src="https://apis.google.com/js/platform.js?onload=renderBadge"
  async defer>
</script>

<script>
  window.renderBadge = function() {
    var ratingBadgeContainer = document.createElement("div");
      document.body.appendChild(ratingBadgeContainer);
      window.gapi.load('ratingbadge', function() {
        window.gapi.ratingbadge.render(
          ratingBadgeContainer, {
            // REQUIRED
            "merchant_id": MERCHANT_ID,
            // OPTIONAL
            "position": "POSITION"
          });           
     });
  }
</script>
<!-- END GCR Badge Code -->
TR’s picture

Status: Active » Fixed

So you're trying to add JavaScript to specific pages on a Drupal site?
Not really an Ubercart issue...
See https://www.drupal.org/docs/8/theming-drupal-8/adding-stylesheets-css-an...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.