Is there a reason why this would give 404 error in the DevTools console tab? Like the page loads 100% fine but the survey opt-in popup fails to show and gives 404 (I did try to contact Google but they don't seem to be able to figure this out)
This is the code I used, and I even tried hard coding the date (aka writing "2018-09-08" with and without the " ") - what it does it takes today's date and adds 7 days to it then formats it to yyyy-mm-dd
please help!
<!-- BEGIN GCR Opt-in Module Code -->
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn"
async defer>
</script>
<script>
var sevenDaysFromNow = new Date().setDate(new Date().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.renderOptIn = function() {
window.gapi.load('surveyoptin', function() {
window.gapi.surveyoptin.render(
{
// REQUIRED
"merchant_id":xxxxxxxx,
"order_id": "{BOOKINGNUMBER}",
"email": "{EMAIL}",
"delivery_country": "CA",
"estimated_delivery_date": formatDate(sevenDaysFromNow),
// OPTIONAL
"opt_in_style": "CENTER_DIALOG"
});
});
}
</script>
<!-- END GCR Opt-in Module Code -->
<!-- BEGIN GCR Language Code -->
<script>
window.___gcfg = {
lang: 'en_US'
};
</script>
<!-- END GCR Language Code -->