I'm trying to add the google customer reviews opt-in survey to my order confirmation page using the code below. The script appears to be working, pulling the correct order information. However, there is no box in the middle of the screen for the customer to opt-in to the survey as google suggested there would be. If anyone has had any success implementing this on Magento 1.9 please help in any way you can.

Thank you.

    $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
    $order = Mage::getModel('sales/order')->load($orderId);
    <script src="https://apis.google.com/js/platform.js?onload=renderOptIn"async defer></script>

    window.renderOptIn = function() {
        window.gapi.load('surveyoptin', function() {
                    "merchant_id": 112592416,
                    "order_id": "<?php echo $order->getIncrementId() ?>",
                    "email": <?php echo $order->getCustomerEmail() ?>,
                    "delivery_country":  "<?php echo $order->getShippingAddress()->getCountryId() ?>",
                    "estimated_delivery_date": "<?php $date = date("Y-m-d"); $mod_date = strtotime($date."+ 6 days"); echo date("Y-m-d",$mod_date); ?>"

<!-- END GCR Opt-in Module Code -->

1 Answer 1


Try to change this line:

"email": getCustomerEmail() ?>,


"email": "getCustomerEmail() ?>",

or, copy and past (check your Merchant ID):

<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>
    window.renderOptIn = function(){
        window.gapi.load('surveyoptin', function(){
              "merchant_id": 112592416,
              "order_id": "<?php echo $order->getIncrementId(); ?>",
              "email": "<?php echo $order->getCustomerEmail(); ?>",
              "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId(); ?>",
              "estimated_delivery_date": "<?php $date = date('Y-m-d'); $mod_date = strtotime($date.'+ 3 days'); echo date('Y-m-d',$mod_date); ?>"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.