Jump to content

Order Confirmation Page / Google customer reviews opt in

Recommended Posts

So, I'm trying to implement Google customer reviews survey from Google merchant centre. However I have come to realise it won't work without being able to grab a date. 

 

Is there a way to add Order placed at XXXX-XX-XX with some javascript on the confirmation page? 

 

The hope is once /if I can add that a date to the page, I can then edit the GCR code to grab that date and add a delay 

 

GCR code looks something like this but this needs editing

<!-- BEGIN GCR Opt-in Module Code -->
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>
<script>// <![CDATA[
var currentTime = new Date()
var day = currentTime.getDate() + 10
var month = currentTime.getMonth() + 1
var year = currentTime.getFullYear()
var final =(year + "/" + month + "/" + day)

  window.renderOptIn = function() {
    window.gapi.load('surveyoptin', function() {
      window.gapi.surveyoptin.render(
        {
          // REQUIRED FIELDS
          "merchant_id": "****",
          "order_id": "{orderId}",
          "email": "{customerEmailAddress}",
          "delivery_country": "GB",
          "estimated_delivery_date": "final",
        });
    });
  }
</script>

Link to comment
  • Replies 1
  • Views 521
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.