Jump to content

Adrian213

Member
  • Posts

    1
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Adrian213's Achievements

Level 1

Level 1 (1/20)

0

Reputation

  1. Hello, If you haven't sorted this already, you need to use Javascript to generate the date - won't work with PHP. I believe the date is used by Google to send the review to the cusomer so it needn't be too specific, in this example I've just added 7 days to the current date: <script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script> <script> window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { const deliveryDate = new Date(); deliveryDate.setDate(deliveryDate.getDate() + 7); function formatDate(date) { var d = new Date(date), month = '' + (d.getMonth() + 1), day = '' + d.getDate(), year = d.getFullYear(); if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; return [year, month, day].join('-'); } window.gapi.surveyoptin.render( { // REQUIRED FIELDS "merchant_id": 12345678, "order_id": "{orderId}", "email": "{customerEmailAddress}", "delivery_country": "GB", "estimated_delivery_date": formatDate(deliveryDate) // OPTIONAL FIELDS //"products": [{"gtin":"GTIN1"}, {"gtin":"GTIN2"}] }); }); } </script> Hope it helps
×
×
  • 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.