Google Review Survey Opt-In Integration

  • Posts: 29
  • Thank you received: 2
  • Hikashop Business
1 week 2 days ago #309873

-- url of the page with the problem -- : www.solarmade.com
-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.4
-- PHP version -- : 7.1.14
-- Browser(s) name and version -- : Chrome 76.0.3809.100
-- Error-message(debug-mod must be tuned on) -- : N/A

Hello,

We are trying to implement the Google Customer Review survey opt-in module by adding the following code to the view checkout / end.php


<!-- BEGIN GCR Opt-in Module Code -->
<script src=" 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": "100618039",
"order_id": "ORDER_ID",
"email": "CUSTOMER_EMAIL",
"delivery_country": "COUNTRY_CODE",
"estimated_delivery_date": "YYYY-MM-DD"

// OPTIONAL
"products":[{"gtin":"GTIN1"}, {"gtin":"GTIN2">}],
"opt_in_style": "CENTER_DIALOG"
});
});
}
</script>
<!-- END GCR Opt-in Module Code -->

<!-- BEGIN GCR Language Code -->
<script>
window.___gcfg = {
lang: 'en-US'
};
</script>
<!-- END GCR Language Code -->


We are having a bit of trouble determining the correct values to use for the variables marked in bold. This code was pulled directly from Google's Integration guide so everything else should be correct aside from the bold values that we need to replace. Here is the data that Google needs from these variables:

ORDER_ID: A unique ID for the order (order number).
CUSTOMER_EMAIL: The customer's email address, in the format This email address is being protected from spambots. You need JavaScript enabled to view it..
COUNTRY_CODE: The two-letter country code identifies where the customer's order will be delivered. This value must be in ISO 3166-1 alpha-2 format. Do not use “ZZ” for this field. For example, "US".
YYYY-MM-DD: The estimated delivery date for the order, where YYYY is the year, MM is the month, and DD is the day. For example, "2016-09-13". (We may be able to use the order creation date for this field, if an estimated delivery date for orders is unavailable.)

Can you offer a bit of help as to how we should enter these variables to send the correct data to Google?

Please Log in or Create an account to join the conversation.

  • Posts: 66619
  • Thank you received: 9806
  • MODERATOR
1 week 10 hours ago #309928

Hi,

The order number is available with the code:

<?php echo $this->order->order_number; ?>
The customer email address is available with;
<?php echo $this->order->customer->user_email; ?>
The country code is available with :
<?php echo $this->order->shipping_address->address_country->zone_code_2; ?>
There is no "estimated date of delivery". Now, you could create a custom field of the table "order" and of the type "text" to enter the delivery date and in that case you can use such code:
<?php echo $this->order->XXX; ?>
where XXX is the column name of the custom field.
If you want to use the order creation date, you can use such code:
<?php echo hikashop_getDate($this->order->order_created,'Y-m-d'); ?>

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum