Google 客户评论脚本代码(预计交货日期)
Google Customer Review script code (Estimated Delivery Date)
我正在我的电子商务 "Thank You" 页面上实施 Google 客户评论脚本。唯一的问题是我无法从当月提取 1 个月后的日期来显示 "estimated_delivery_date"。其他一切正常。
日期必须完全采用以下格式:"yyyy-mm-dd"。
这是我目前的代码:
<script>
var emailAddress = Order[9]; // pulls customer's email
var datePurchased = new Date();
var yyyy = datePurchased.getFullYear();
var mm = datePurchased.getMonth()+1;
var dd = datePurchased.getDate();
var delivery = yyyy+'-'+mm+'-'+dd;
window.renderOptIn = function() {
window.gapi.load('surveyoptin', function() {
window.gapi.surveyoptin.render(
{
"merchant_id": 7654321,
"order_id": "$(OrderNo)", // pulls order number
"email": emailAddress, // pulls customer's email
"delivery_country": "US",
"estimated_delivery_date": "delivery", // not pulling delivery date. Why?
});
});
}
</script>
感谢您的帮助!
您正在以字符串形式传递交货:
"estimated_delivery_date": "delivery", // not pulling delivery date. Why?
尝试:
<script>
var emailAddress = Order[9];
var datePurchased = new Date();
var yyyy = datePurchased.getFullYear();
var mm = datePurchased.getMonth()+1;
var dd = datePurchased.getDate();
var delivery = yyyy+'-'+mm+'-'+dd;
window.renderOptIn = function() {
window.gapi.load('surveyoptin', function() {
window.gapi.surveyoptin.render(
{
"merchant_id": 7654321,
"order_id": "$(OrderNo)",
"email": emailAddress,
"delivery_country": "US",
"estimated_delivery_date": delivery
});
});
}
</script>
我正在我的电子商务 "Thank You" 页面上实施 Google 客户评论脚本。唯一的问题是我无法从当月提取 1 个月后的日期来显示 "estimated_delivery_date"。其他一切正常。
日期必须完全采用以下格式:"yyyy-mm-dd"。
这是我目前的代码:
<script>
var emailAddress = Order[9]; // pulls customer's email
var datePurchased = new Date();
var yyyy = datePurchased.getFullYear();
var mm = datePurchased.getMonth()+1;
var dd = datePurchased.getDate();
var delivery = yyyy+'-'+mm+'-'+dd;
window.renderOptIn = function() {
window.gapi.load('surveyoptin', function() {
window.gapi.surveyoptin.render(
{
"merchant_id": 7654321,
"order_id": "$(OrderNo)", // pulls order number
"email": emailAddress, // pulls customer's email
"delivery_country": "US",
"estimated_delivery_date": "delivery", // not pulling delivery date. Why?
});
});
}
</script>
感谢您的帮助!
您正在以字符串形式传递交货:
"estimated_delivery_date": "delivery", // not pulling delivery date. Why?
尝试:
<script>
var emailAddress = Order[9];
var datePurchased = new Date();
var yyyy = datePurchased.getFullYear();
var mm = datePurchased.getMonth()+1;
var dd = datePurchased.getDate();
var delivery = yyyy+'-'+mm+'-'+dd;
window.renderOptIn = function() {
window.gapi.load('surveyoptin', function() {
window.gapi.surveyoptin.render(
{
"merchant_id": 7654321,
"order_id": "$(OrderNo)",
"email": emailAddress,
"delivery_country": "US",
"estimated_delivery_date": delivery
});
});
}
</script>