Your best approach is to create a file (say jscript_gsr_optin.php) in /includes/modules/pages/checkout_success. That newly-added file should look similar to
Code:
<?php
if (empty($order_summary)) {
return;
}
?>
<!-- BEGIN GCR Opt-in Module Code -->
<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": "MERCHANT_ID", //- Your Merchant ID value
"order_id": "<?php echo $order->info['order_id']; ?>",
"email": "<?php echo $order->customer['email_address']; ?>",
"delivery_country": "<?php echo (!empty($order->delivery['country']['iso_code_2']) ? $order->delivery['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; ?>",
"estimated_delivery_date": "YYYY-MM-DD", //- The purchase date/time is present in $order->info['date_purchased']
Bookmarks