Created
October 9, 2017 11:52
-
-
Save joe-dempsey/4ed55937b7292907e90eae05d830b2ff to your computer and use it in GitHub Desktop.
Google code for reviews shopify checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<code> | |
{% if customer.default_address.country | json == 'United Kingdom' %} | |
{% comment %} | |
Delivery may take up to 7 days in this case so we're doing date + 7 days and assigning it. | |
{% endcomment %} | |
{% assign seconds = 7 | times: 24 | times: 60 | times: 60 %} | |
<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 | |
"merchant_id": enter your merchant id here, | |
"order_id": "{{ order.id }}", | |
"email": "{{ customer.email }}", | |
"delivery_country": "GB", | |
"estimated_delivery_date": "{{ "now" | date: "%s" | plus: seconds | date: "%Y-%m-%d" }}", | |
// OPTIONAL | |
"opt_in_style": "CENTRE_DIALOG" | |
}); | |
}); | |
} | |
</script> | |
{% endif %} | |
</code> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you'll know if you go to order status page - you will see popup and can inspect console etc.