Jump to content

Google Customer Reviews


Recommended Posts

Dear Forum Members,

 

As stated here Within Merchant Center it now is possible to integrate Google Customer Reviews to your website with the folowing code:

 

<!-- 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",
         "order_id": "ORDER_ID",
         "email": "CUSTOMER_EMAIL",
         "delivery_country": "COUNTRY_CODE",
         "estimated_delivery_date": "YYYY-MM-DD",

         // OPTIONAL
         "opt_in_style": "OPT_IN_STYLE"
       }); 
    });
 }
</script>
<!-- END GCR Opt-in Module Code -->

 

For integrating this code in WHMCS I think in need to create a custom hook and replace the variables in the script with the corresponding smarty variables. I consulted the hook reference here and I think this is the hook we need to use:

 

<?php
add_hook('AfterShoppingCartCheckout', 1, function($vars) {
   // Perform hook code here...
});

 

Because the smarty variables need to be put in the javascript part of Google but i think it will only work on tpl files and not in PHP. I'm not really a codehead myself, so is there someone who can help me put this 3 different languages together to make this script to work on WHMCS in the correct way. I think a lot of people will be happy to use this piece of code.

 

Thanks a lot!

Link to comment
Share on other sites

  • 6 months later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated