Google Customer Reviews

AbbasAbbas Member Posts: 44
edited November 2018 in General
Has anyone been able to succesfully add GCR to the thankyou page?



I think the only issue is to find a suited dynamic value for  "estimated_delivery_date": "YYYY-MM-DD",
This is a required value.

This is the full list google has provided to troubleshoot:
  • Ensure that all pages, including the order confirmation page, have the correct page formatting: <!DOCTYPE html>

  • e-commerce platforms may cause compatibility issues - if this is the case, please reach out to e-commerce provider for assistance

  • The entire survey opt in code is added to the order confirmation page with no additional snippets

  • Customers need to be redirected back to your page after order has been completed

  • Code cannot be hard-coded on order confirmation page

  • Do not use Tag Manager in combination with the survey opt-in module as they are not compatible

  • Your shopping basket and confirmation pages must be hosted on your own site URL, incl. opt-in code

  • Ensure that the estimated delivery date is the correct format

  • Disable any pop-up blockers when placing a test order as this may suppress the survey pop up

  • Ensure that the variables have been populated correctly in the survey opt-in module once you’ve placed a test order - should this not be the case, please double check your JavaScript

  • All confirmation pages must use HTTPS

  • If you wish to collect product ratings as well, please make sure to add the GTIN snippets to the opt-in module. However, this is optional. You can read more about this in our helpcenter



If anyone has advice it would be greatly appreciated

Post edited by Abbas on

7 comments

  • JoeyJoey Administrator, Moderator, Lightspeed Staff Posts: 193 moderator
    You are correct in regards to adding the code to the Tracking section (Settings -> Web Extras).
    There is no variable for the estimated delivery date but you can, however, sent a "fixed" date:
    {{ "now"|date_modify("+4 day")|date("Y-m-d") }}
    This will create todays date +4 days, which you can change to any amount of days.

    Hope this helps.
    eCom Support Team
    Lightspeed HQ
  • AbbasAbbas Member Posts: 44
    @Joey I have tried the code you kindly provided and still no joy?

    I suspect maybe the trouble shooting issues above may be a problem in particular :
    1-Code cannot be hard-coded on order confirmation page
    2- Do not use Tag Manager in combination with the survey opt-in module as they are not compatible
    3- e-commerce platforms may cause compatibility issues - if this is the case, please reach out to e-commerce provider for assistance

    I have removed tag manager from Tacking dont know if they mean to remove it from entire site JS also?

    Thanks
  • AbbasAbbas Member Posts: 44
    I have got it working after removing all other Gtag / analytics code.

    The only element that I cant get to work is this -

              // OPTIONAL FIELDS
              "products": [{"gtin":"{{ product.title }}"}, {"gtin":"{{ product.title }}"}]

    This is the example google gives are


    an specifically

    so I identified EAN as the correct value as the barcode field from retail is what seems to feed this:

     // OPTIONAL FIELDS
              "products": [{"gtin”:”{{ product.ean }}"}, {"gtin”:”{{ product.ean }}"}, {"gtin”:”{{ product.ean }}"}]

    This makes it fail though?

    Thanks







  • JoeyJoey Administrator, Moderator, Lightspeed Staff Posts: 193 moderator
    edited December 2018
    The EAN code is indeed pulled from the UPC in Retail, in eCom you have the following two identifier fields available:
    • {{ product.ean }} - The European Article Number code (but this can also be the UPC code, depending on what you use
    • {{ product.sku }} - The Stock-Keeping Unit number
    Have you added the Products inside a loop? Here is an example:
    "products":[
    {% for product in order.products %}

    {"gtin":"{{ product.sku }}"},
    {% endfor %}]
    Hope this helps!

    Update: Fixed a typo
    Post edited by Joey on
    eCom Support Team
    Lightspeed HQ
  • AbbasAbbas Member Posts: 44
    edited December 2018
    I tried the new code with the GTIN AND LOOP solution you very kindly provided and it initially gave us an internal server error: 

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    More information about this error may be available in the server error log.Message ID: 7e232a8277acae1b0385285eef07be5b


    Then I added a (d) into this bit {% enfor %}] and the server errors went but the pop up didn't load.

    I just did a test checkout on the product ecom test and the popup does load now just as it did 3 or 4 days ago but so far no survey email from google.

    It is this bit of code that is making it fail now. I don't know if it is all supposed to be on one line or not?  "products": [{% for product in order.products %} {"gtin":"{{ product.ean }}"},

               {% endfor %}]

    This is all of the examples google provide

    Example 1


    Example 2 - Step 3


    GTIN Instructions


    This is the latest working code now (Working BUT yet to receive a review email as of 5th dec 2018)

    <!-- 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 FIELDS          "merchant_id": MERCHANTID,          "order_id": "{{ order.information.number }}",          "email": "{{ order.customer.email }}",          "delivery_country": "{{ order.shipping.country_code }}",          "estimated_delivery_date": "{{ "now"|date_modify("+4 day")|date("Y-m-d") }}",          "opt_in_style": "BOTTOM_RIGHT_DIALOG"
              // OPTIONAL FIELDSNEEDS GTIN VALUE HERE / VARIABLE        });    });  }</script><!-- END GCR Opt-in Module Code -->
    <!-- BEGIN GCR Language Code --><script>  window.___gcfg = {    lang: 'en_GB'  };</script><!-- END GCR Language Code -->

    After checking and checking through everything the only other doubt is the date format requirements


  • AbbasAbbas Member Posts: 44
    edited December 2018
  • AbbasAbbas Member Posts: 44
    I have now got it working with GTIN value for 1 product! still yet to receive a review request. 

    This is the code that now works but without the all important loop!


    <!-- 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 FIELDS          "merchant_id": MERCHANTCODE,          "order_id": "{{ order.information.number }}",          "email": "{{ order.customer.email }}",          "delivery_country": "{{ order.shipping.country_code }}",          "estimated_delivery_date": "{{ "now"|date_modify("+4 day")|date("Y-m-d") }}",
              // OPTIONAL           "opt_in_style": "BOTTOM_RIGHT_DIALOG", "product_name": "{{ product.title }}",           "products": [{"gtin":"product.ean"}]        });    });  }</script><!-- END GCR Opt-in Module Code -->
    <!-- BEGIN GCR Language Code --><script>  window.___gcfg = {    lang: 'en_GB'  };</script><!-- END GCR Language Code -->

Sign In or Register to comment.