Magento 2 : Google Customer ReviewsHow to setup Google Customer Reviews in Magento 2?Magento2: plugin around method not workingI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Cancel the orders which are older than 3 daysWhy is overriding a block function causing template errors?Magento 2 - redirect to final checkout page (checkout success/failed)How to get last ordered product details in Magento 2.2?Magento 2.2.5: Overriding Admin Controller sales/ordermagento 2 place order programmatically from controllerMagento2 checkout/onepage/success redirects to cartMagento 2.3 Can't view module's front end page output?

What is this little owl-like bird?

Some interesting calculation puzzle that I made

How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?

RPI3B+: What are the four components below the HDMI connector called?

Is English unusual in having no second person plural form?

How do you move up one folder in Finder?

When an electron changes its spin, or any other intrinsic property, is it still the same electron?

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

Short story about Nobel Prize winning scientists that drop out when they realise they were incorrect

Is it OK to leave real names & info visible in business card portfolio?

What were the main German words for a prostitute before 1800?

Civic overheating and hoses popping

Why does this potentiometer in an op-amp feedback path cause noise when adjusted?

Salt, pepper, herbs and spices

Apex code to find record diff between two dates (to call API only when needed)

How can a dictatorship government be beneficial to a dictator in a post-scarcity society?

How are mathematicians paid to do research?

Addressing unnecessary daily meetings with manager?

Why isn't pressure filtration popular compared to vacuum filtration?

Optimization terminology: "Exact" v. "Approximate"

How to drill holes in 3/8" thick steel plates?

Managing and organizing the massively increased number of classes after switching to SOLID?

Why do we need common sense in AI?

How can I effectively communicate to recruiters that a phone call is not possible?



Magento 2 : Google Customer Reviews


How to setup Google Customer Reviews in Magento 2?Magento2: plugin around method not workingI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Cancel the orders which are older than 3 daysWhy is overriding a block function causing template errors?Magento 2 - redirect to final checkout page (checkout success/failed)How to get last ordered product details in Magento 2.2?Magento 2.2.5: Overriding Admin Controller sales/ordermagento 2 place order programmatically from controllerMagento2 checkout/onepage/success redirects to cartMagento 2.3 Can't view module's front end page output?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















How will final result should look like for this implementation.
Thank you



file location: /vendor/magento/module-checkout/Controller/Onepage/Success.php



Below is my default Success.php for Magento 2.1



<?php /** * * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace MagentoCheckoutControllerOnepage;

class Success extends MagentoCheckoutControllerOnepage
/**
* Order success action
*
* @return MagentoFrameworkControllerResultInterface
*/
public function execute()

$session = $this->getOnepage()->getCheckout();
if (!$this->_objectManager->get('MagentoCheckoutModelSessionSuccessValidator')->isValid())
return $this->resultRedirectFactory->create()->setPath('checkout/cart');

$session->clearQuote();
//@todo: Refactor it to match CQRS
$resultPage = $this->resultPageFactory->create();
$this->_eventManager->dispatch(
'checkout_onepage_controller_success_action',
['order_ids' => [$session->getLastOrderId()]]
);
return $resultPage;



............................ where do i paste this code on Success.php




<script>
window.renderOptIn = function()
window.gapi.load('surveyoptin', function()
window.gapi.surveyoptin.render(

"merchant_id": XXXXXXXXX,
"order_id": "<?php echo $order->getIncrementId() ?>",
"email": "<?php echo $order->getCustomerEmail() ?>",
"delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
"estimated_delivery_date": "YYYY-MM-DD"
);
);

</script>











share|improve this question






























    4















    How will final result should look like for this implementation.
    Thank you



    file location: /vendor/magento/module-checkout/Controller/Onepage/Success.php



    Below is my default Success.php for Magento 2.1



    <?php /** * * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace MagentoCheckoutControllerOnepage;

    class Success extends MagentoCheckoutControllerOnepage
    /**
    * Order success action
    *
    * @return MagentoFrameworkControllerResultInterface
    */
    public function execute()

    $session = $this->getOnepage()->getCheckout();
    if (!$this->_objectManager->get('MagentoCheckoutModelSessionSuccessValidator')->isValid())
    return $this->resultRedirectFactory->create()->setPath('checkout/cart');

    $session->clearQuote();
    //@todo: Refactor it to match CQRS
    $resultPage = $this->resultPageFactory->create();
    $this->_eventManager->dispatch(
    'checkout_onepage_controller_success_action',
    ['order_ids' => [$session->getLastOrderId()]]
    );
    return $resultPage;



    ............................ where do i paste this code on Success.php




    <script>
    window.renderOptIn = function()
    window.gapi.load('surveyoptin', function()
    window.gapi.surveyoptin.render(

    "merchant_id": XXXXXXXXX,
    "order_id": "<?php echo $order->getIncrementId() ?>",
    "email": "<?php echo $order->getCustomerEmail() ?>",
    "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
    "estimated_delivery_date": "YYYY-MM-DD"
    );
    );

    </script>











    share|improve this question


























      4












      4








      4








      How will final result should look like for this implementation.
      Thank you



      file location: /vendor/magento/module-checkout/Controller/Onepage/Success.php



      Below is my default Success.php for Magento 2.1



      <?php /** * * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace MagentoCheckoutControllerOnepage;

      class Success extends MagentoCheckoutControllerOnepage
      /**
      * Order success action
      *
      * @return MagentoFrameworkControllerResultInterface
      */
      public function execute()

      $session = $this->getOnepage()->getCheckout();
      if (!$this->_objectManager->get('MagentoCheckoutModelSessionSuccessValidator')->isValid())
      return $this->resultRedirectFactory->create()->setPath('checkout/cart');

      $session->clearQuote();
      //@todo: Refactor it to match CQRS
      $resultPage = $this->resultPageFactory->create();
      $this->_eventManager->dispatch(
      'checkout_onepage_controller_success_action',
      ['order_ids' => [$session->getLastOrderId()]]
      );
      return $resultPage;



      ............................ where do i paste this code on Success.php




      <script>
      window.renderOptIn = function()
      window.gapi.load('surveyoptin', function()
      window.gapi.surveyoptin.render(

      "merchant_id": XXXXXXXXX,
      "order_id": "<?php echo $order->getIncrementId() ?>",
      "email": "<?php echo $order->getCustomerEmail() ?>",
      "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
      "estimated_delivery_date": "YYYY-MM-DD"
      );
      );

      </script>











      share|improve this question
















      How will final result should look like for this implementation.
      Thank you



      file location: /vendor/magento/module-checkout/Controller/Onepage/Success.php



      Below is my default Success.php for Magento 2.1



      <?php /** * * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace MagentoCheckoutControllerOnepage;

      class Success extends MagentoCheckoutControllerOnepage
      /**
      * Order success action
      *
      * @return MagentoFrameworkControllerResultInterface
      */
      public function execute()

      $session = $this->getOnepage()->getCheckout();
      if (!$this->_objectManager->get('MagentoCheckoutModelSessionSuccessValidator')->isValid())
      return $this->resultRedirectFactory->create()->setPath('checkout/cart');

      $session->clearQuote();
      //@todo: Refactor it to match CQRS
      $resultPage = $this->resultPageFactory->create();
      $this->_eventManager->dispatch(
      'checkout_onepage_controller_success_action',
      ['order_ids' => [$session->getLastOrderId()]]
      );
      return $resultPage;



      ............................ where do i paste this code on Success.php




      <script>
      window.renderOptIn = function()
      window.gapi.load('surveyoptin', function()
      window.gapi.surveyoptin.render(

      "merchant_id": XXXXXXXXX,
      "order_id": "<?php echo $order->getIncrementId() ?>",
      "email": "<?php echo $order->getCustomerEmail() ?>",
      "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
      "estimated_delivery_date": "YYYY-MM-DD"
      );
      );

      </script>








      magento2 review code-generation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 2 at 6:19









      Raj Mohan R

      1,4713 silver badges12 bronze badges




      1,4713 silver badges12 bronze badges










      asked Apr 4 '17 at 17:03









      rogerroger

      1712 silver badges16 bronze badges




      1712 silver badges16 bronze badges




















          3 Answers
          3






          active

          oldest

          votes


















          1














          I think you would use the file located at or whatever the vendor/template you use



          vendor/magento/module-checkout/view/frontend/templates/success.phtml


          In which case, you would put the google code after the last in the success.phtml file






          share|improve this answer
































            0














            You need to put this code in vendor/magento/module-checkout/view/frontend/templates/success.phtml.



            <?php
            /**
            * Copyright © Magento, Inc. All rights reserved.
            * See COPYING.txt for license details.
            */

            // @codingStandardsIgnoreFile

            ?>
            <?php /** @var $block MagentoCheckoutBlockOnepageSuccess */ ?>
            <div class="checkout-success">
            <?php if ($block->getOrderId()):?>
            <?php if ($block->getCanViewOrder()) :?>
            <p><?= __('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeHtml($block->getViewOrderUrl()), $block->escapeHtml($block->getOrderId()))) ?></p>
            <?php else :?>
            <p><?= __('Your order # is: <span>%1</span>.', $block->escapeHtml($block->getOrderId())) ?></p>
            <?php endif;?>
            <p><?= /* @escapeNotVerified */ __('We'll email you an order confirmation with details and tracking info.') ?></p>
            <?php endif;?>

            <?= $block->getAdditionalInfoHtml() ?>

            <div class="actions-toolbar">
            <div class="primary">
            <a class="action primary continue" href="<?= /* @escapeNotVerified */ $block->getContinueUrl() ?>"><span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span></a>
            </div>
            </div>
            </div>
            <script>
            window.renderOptIn = function()
            window.gapi.load('surveyoptin', function()
            window.gapi.surveyoptin.render(

            "merchant_id": XXXXXXXXX,
            "order_id": "<?php echo $order->getIncrementId() ?>",
            "email": "<?php echo $order->getCustomerEmail() ?>",
            "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
            "estimated_delivery_date": "YYYY-MM-DD"
            );
            );

            </script>





            share|improve this answer






























              -1














              app/design/frontend/magento/theme/Magento_Checkout/templates/success.phtml



              Add this script



              <script>

              window.renderOptIn = function()

              window.gapi.load('surveyoptin', function()

              window.gapi.surveyoptin.render(



              "merchant_id": xxxxxxxxx,

              "order_id": "<?php echo $orderData->getIncrementId() ?>",

              "email": "<?php echo $orderData->getCustomerEmail() ?>",

              "delivery_country": "<?php echo $orderData->getShippingAddress()->getCountryId() ?>",

              "estimated_delivery_date": "YYYY-MM-DD"

              );

              );



              </script>





              share|improve this answer























              • This looks like code for Magento 1, not Magento 2.

                – Steve Robbins
                Nov 14 '17 at 19:27













              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f167643%2fmagento-2-google-customer-reviews%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              I think you would use the file located at or whatever the vendor/template you use



              vendor/magento/module-checkout/view/frontend/templates/success.phtml


              In which case, you would put the google code after the last in the success.phtml file






              share|improve this answer





























                1














                I think you would use the file located at or whatever the vendor/template you use



                vendor/magento/module-checkout/view/frontend/templates/success.phtml


                In which case, you would put the google code after the last in the success.phtml file






                share|improve this answer



























                  1












                  1








                  1







                  I think you would use the file located at or whatever the vendor/template you use



                  vendor/magento/module-checkout/view/frontend/templates/success.phtml


                  In which case, you would put the google code after the last in the success.phtml file






                  share|improve this answer















                  I think you would use the file located at or whatever the vendor/template you use



                  vendor/magento/module-checkout/view/frontend/templates/success.phtml


                  In which case, you would put the google code after the last in the success.phtml file







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 12 '17 at 1:21









                  Rafael Corrêa Gomes

                  5,0102 gold badges36 silver badges70 bronze badges




                  5,0102 gold badges36 silver badges70 bronze badges










                  answered Apr 11 '17 at 20:07









                  dawhoodawhoo

                  5334 silver badges25 bronze badges




                  5334 silver badges25 bronze badges























                      0














                      You need to put this code in vendor/magento/module-checkout/view/frontend/templates/success.phtml.



                      <?php
                      /**
                      * Copyright © Magento, Inc. All rights reserved.
                      * See COPYING.txt for license details.
                      */

                      // @codingStandardsIgnoreFile

                      ?>
                      <?php /** @var $block MagentoCheckoutBlockOnepageSuccess */ ?>
                      <div class="checkout-success">
                      <?php if ($block->getOrderId()):?>
                      <?php if ($block->getCanViewOrder()) :?>
                      <p><?= __('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeHtml($block->getViewOrderUrl()), $block->escapeHtml($block->getOrderId()))) ?></p>
                      <?php else :?>
                      <p><?= __('Your order # is: <span>%1</span>.', $block->escapeHtml($block->getOrderId())) ?></p>
                      <?php endif;?>
                      <p><?= /* @escapeNotVerified */ __('We'll email you an order confirmation with details and tracking info.') ?></p>
                      <?php endif;?>

                      <?= $block->getAdditionalInfoHtml() ?>

                      <div class="actions-toolbar">
                      <div class="primary">
                      <a class="action primary continue" href="<?= /* @escapeNotVerified */ $block->getContinueUrl() ?>"><span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span></a>
                      </div>
                      </div>
                      </div>
                      <script>
                      window.renderOptIn = function()
                      window.gapi.load('surveyoptin', function()
                      window.gapi.surveyoptin.render(

                      "merchant_id": XXXXXXXXX,
                      "order_id": "<?php echo $order->getIncrementId() ?>",
                      "email": "<?php echo $order->getCustomerEmail() ?>",
                      "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
                      "estimated_delivery_date": "YYYY-MM-DD"
                      );
                      );

                      </script>





                      share|improve this answer



























                        0














                        You need to put this code in vendor/magento/module-checkout/view/frontend/templates/success.phtml.



                        <?php
                        /**
                        * Copyright © Magento, Inc. All rights reserved.
                        * See COPYING.txt for license details.
                        */

                        // @codingStandardsIgnoreFile

                        ?>
                        <?php /** @var $block MagentoCheckoutBlockOnepageSuccess */ ?>
                        <div class="checkout-success">
                        <?php if ($block->getOrderId()):?>
                        <?php if ($block->getCanViewOrder()) :?>
                        <p><?= __('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeHtml($block->getViewOrderUrl()), $block->escapeHtml($block->getOrderId()))) ?></p>
                        <?php else :?>
                        <p><?= __('Your order # is: <span>%1</span>.', $block->escapeHtml($block->getOrderId())) ?></p>
                        <?php endif;?>
                        <p><?= /* @escapeNotVerified */ __('We'll email you an order confirmation with details and tracking info.') ?></p>
                        <?php endif;?>

                        <?= $block->getAdditionalInfoHtml() ?>

                        <div class="actions-toolbar">
                        <div class="primary">
                        <a class="action primary continue" href="<?= /* @escapeNotVerified */ $block->getContinueUrl() ?>"><span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span></a>
                        </div>
                        </div>
                        </div>
                        <script>
                        window.renderOptIn = function()
                        window.gapi.load('surveyoptin', function()
                        window.gapi.surveyoptin.render(

                        "merchant_id": XXXXXXXXX,
                        "order_id": "<?php echo $order->getIncrementId() ?>",
                        "email": "<?php echo $order->getCustomerEmail() ?>",
                        "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
                        "estimated_delivery_date": "YYYY-MM-DD"
                        );
                        );

                        </script>





                        share|improve this answer

























                          0












                          0








                          0







                          You need to put this code in vendor/magento/module-checkout/view/frontend/templates/success.phtml.



                          <?php
                          /**
                          * Copyright © Magento, Inc. All rights reserved.
                          * See COPYING.txt for license details.
                          */

                          // @codingStandardsIgnoreFile

                          ?>
                          <?php /** @var $block MagentoCheckoutBlockOnepageSuccess */ ?>
                          <div class="checkout-success">
                          <?php if ($block->getOrderId()):?>
                          <?php if ($block->getCanViewOrder()) :?>
                          <p><?= __('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeHtml($block->getViewOrderUrl()), $block->escapeHtml($block->getOrderId()))) ?></p>
                          <?php else :?>
                          <p><?= __('Your order # is: <span>%1</span>.', $block->escapeHtml($block->getOrderId())) ?></p>
                          <?php endif;?>
                          <p><?= /* @escapeNotVerified */ __('We'll email you an order confirmation with details and tracking info.') ?></p>
                          <?php endif;?>

                          <?= $block->getAdditionalInfoHtml() ?>

                          <div class="actions-toolbar">
                          <div class="primary">
                          <a class="action primary continue" href="<?= /* @escapeNotVerified */ $block->getContinueUrl() ?>"><span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span></a>
                          </div>
                          </div>
                          </div>
                          <script>
                          window.renderOptIn = function()
                          window.gapi.load('surveyoptin', function()
                          window.gapi.surveyoptin.render(

                          "merchant_id": XXXXXXXXX,
                          "order_id": "<?php echo $order->getIncrementId() ?>",
                          "email": "<?php echo $order->getCustomerEmail() ?>",
                          "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
                          "estimated_delivery_date": "YYYY-MM-DD"
                          );
                          );

                          </script>





                          share|improve this answer













                          You need to put this code in vendor/magento/module-checkout/view/frontend/templates/success.phtml.



                          <?php
                          /**
                          * Copyright © Magento, Inc. All rights reserved.
                          * See COPYING.txt for license details.
                          */

                          // @codingStandardsIgnoreFile

                          ?>
                          <?php /** @var $block MagentoCheckoutBlockOnepageSuccess */ ?>
                          <div class="checkout-success">
                          <?php if ($block->getOrderId()):?>
                          <?php if ($block->getCanViewOrder()) :?>
                          <p><?= __('Your order number is: %1.', sprintf('<a href="%s" class="order-number"><strong>%s</strong></a>', $block->escapeHtml($block->getViewOrderUrl()), $block->escapeHtml($block->getOrderId()))) ?></p>
                          <?php else :?>
                          <p><?= __('Your order # is: <span>%1</span>.', $block->escapeHtml($block->getOrderId())) ?></p>
                          <?php endif;?>
                          <p><?= /* @escapeNotVerified */ __('We'll email you an order confirmation with details and tracking info.') ?></p>
                          <?php endif;?>

                          <?= $block->getAdditionalInfoHtml() ?>

                          <div class="actions-toolbar">
                          <div class="primary">
                          <a class="action primary continue" href="<?= /* @escapeNotVerified */ $block->getContinueUrl() ?>"><span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span></a>
                          </div>
                          </div>
                          </div>
                          <script>
                          window.renderOptIn = function()
                          window.gapi.load('surveyoptin', function()
                          window.gapi.surveyoptin.render(

                          "merchant_id": XXXXXXXXX,
                          "order_id": "<?php echo $order->getIncrementId() ?>",
                          "email": "<?php echo $order->getCustomerEmail() ?>",
                          "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
                          "estimated_delivery_date": "YYYY-MM-DD"
                          );
                          );

                          </script>






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 13 at 6:20









                          Dhaduk MiteshDhaduk Mitesh

                          6712 silver badges18 bronze badges




                          6712 silver badges18 bronze badges





















                              -1














                              app/design/frontend/magento/theme/Magento_Checkout/templates/success.phtml



                              Add this script



                              <script>

                              window.renderOptIn = function()

                              window.gapi.load('surveyoptin', function()

                              window.gapi.surveyoptin.render(



                              "merchant_id": xxxxxxxxx,

                              "order_id": "<?php echo $orderData->getIncrementId() ?>",

                              "email": "<?php echo $orderData->getCustomerEmail() ?>",

                              "delivery_country": "<?php echo $orderData->getShippingAddress()->getCountryId() ?>",

                              "estimated_delivery_date": "YYYY-MM-DD"

                              );

                              );



                              </script>





                              share|improve this answer























                              • This looks like code for Magento 1, not Magento 2.

                                – Steve Robbins
                                Nov 14 '17 at 19:27















                              -1














                              app/design/frontend/magento/theme/Magento_Checkout/templates/success.phtml



                              Add this script



                              <script>

                              window.renderOptIn = function()

                              window.gapi.load('surveyoptin', function()

                              window.gapi.surveyoptin.render(



                              "merchant_id": xxxxxxxxx,

                              "order_id": "<?php echo $orderData->getIncrementId() ?>",

                              "email": "<?php echo $orderData->getCustomerEmail() ?>",

                              "delivery_country": "<?php echo $orderData->getShippingAddress()->getCountryId() ?>",

                              "estimated_delivery_date": "YYYY-MM-DD"

                              );

                              );



                              </script>





                              share|improve this answer























                              • This looks like code for Magento 1, not Magento 2.

                                – Steve Robbins
                                Nov 14 '17 at 19:27













                              -1












                              -1








                              -1







                              app/design/frontend/magento/theme/Magento_Checkout/templates/success.phtml



                              Add this script



                              <script>

                              window.renderOptIn = function()

                              window.gapi.load('surveyoptin', function()

                              window.gapi.surveyoptin.render(



                              "merchant_id": xxxxxxxxx,

                              "order_id": "<?php echo $orderData->getIncrementId() ?>",

                              "email": "<?php echo $orderData->getCustomerEmail() ?>",

                              "delivery_country": "<?php echo $orderData->getShippingAddress()->getCountryId() ?>",

                              "estimated_delivery_date": "YYYY-MM-DD"

                              );

                              );



                              </script>





                              share|improve this answer













                              app/design/frontend/magento/theme/Magento_Checkout/templates/success.phtml



                              Add this script



                              <script>

                              window.renderOptIn = function()

                              window.gapi.load('surveyoptin', function()

                              window.gapi.surveyoptin.render(



                              "merchant_id": xxxxxxxxx,

                              "order_id": "<?php echo $orderData->getIncrementId() ?>",

                              "email": "<?php echo $orderData->getCustomerEmail() ?>",

                              "delivery_country": "<?php echo $orderData->getShippingAddress()->getCountryId() ?>",

                              "estimated_delivery_date": "YYYY-MM-DD"

                              );

                              );



                              </script>






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jun 7 '17 at 12:56









                              Jyoti ThakurJyoti Thakur

                              1




                              1












                              • This looks like code for Magento 1, not Magento 2.

                                – Steve Robbins
                                Nov 14 '17 at 19:27

















                              • This looks like code for Magento 1, not Magento 2.

                                – Steve Robbins
                                Nov 14 '17 at 19:27
















                              This looks like code for Magento 1, not Magento 2.

                              – Steve Robbins
                              Nov 14 '17 at 19:27





                              This looks like code for Magento 1, not Magento 2.

                              – Steve Robbins
                              Nov 14 '17 at 19:27

















                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f167643%2fmagento-2-google-customer-reviews%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown