[Skip to main content](#vessel-content)

#   Google Review Survey Opt-In Integration

##

- **[SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")**
- [![SolarMade's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar37282.jpg)](/forum/user/37282-solarmade "View SolarMade's Profile") Topic Author
- [ Offline](/forum/user/37282-solarmade)

Less More

- Posts: 31
- Thank you received: 3
-
-
- [](http://www.solarmade.com)
-

7 years 2 months ago [\#309873](#309873) by [SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")  *[Google Review Survey Opt-In Integration](/forum/30-integrations/898095-google-review-survey-opt-in-integration#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       window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { window.gapi.surveyoptin.render( { // REQUIRED &quot;merchant&#95;id&quot;: &quot;100618039&quot;, &quot;order&#95;id&quot;: &quot;ORDER&#95;ID&quot;, &quot;email&quot;: &quot;CUSTOMER&#95;EMAIL&quot;, &quot;delivery&#95;country&quot;: &quot;COUNTRY&#95;CODE&quot;, &quot;estimated&#95;delivery&#95;date&quot;: &quot;YYYY-MM-DD&quot;  // OPTIONAL &quot;products&quot;:&#91;{&quot;gtin&quot;:&quot;GTIN1&quot;}, {&quot;gtin&quot;:&quot;GTIN2&quot;&gt;}&#93;, &quot;opt&#95;in&#95;style&quot;: &quot;CENTER&#95;DIALOG&quot; }); }); }      window.&#95;&#95;&#95;gcfg = { lang: 'en-US' };    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&#95;ID: A unique ID for the order (order number). CUSTOMER&#95;EMAIL: The customer's email address, in the format COUNTRY&#95;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, &quot;US&quot;. 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, &quot;2016-09-13&quot;. (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?")* was created by *[SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")*

-- url of the page with the problem -- : [ www.solarmade.com](https://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

&lt;!-- BEGIN GCR Opt-in Module Code --&gt;
&lt;script src="[ apis.google.com/js/platform.js?onload=renderOptIn](https://apis.google.com/js/platform.js?onload=renderOptIn)"
async defer&gt;
&lt;/script&gt;

&lt;script&gt;
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"&gt;}],
"opt_in_style": "CENTER_DIALOG"
});
});
}
&lt;/script&gt;
&lt;!-- END GCR Opt-in Module Code --&gt;

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

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 name@domain.com.
**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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84OTgwOTUtZ29vZ2xlLXJldmlldy1zdXJ2ZXktb3B0LWluLWludGVncmF0aW9uP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86284
- Thank you received: 14263
-
-

7 years 2 months ago [\#309928](#309928) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Google Review Survey Opt-In Integration](/forum/30-integrations/898095-google-review-survey-opt-in-integration#309928 "-- 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       window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { window.gapi.surveyoptin.render( { // REQUIRED &quot;merchant&#95;id&quot;: &quot;100618039&quot;, &quot;order&#95;id&quot;: &quot;ORDER&#95;ID&quot;, &quot;email&quot;: &quot;CUSTOMER&#95;EMAIL&quot;, &quot;delivery&#95;country&quot;: &quot;COUNTRY&#95;CODE&quot;, &quot;estimated&#95;delivery&#95;date&quot;: &quot;YYYY-MM-DD&quot;  // OPTIONAL &quot;products&quot;:&#91;{&quot;gtin&quot;:&quot;GTIN1&quot;}, {&quot;gtin&quot;:&quot;GTIN2&quot;&gt;}&#93;, &quot;opt&#95;in&#95;style&quot;: &quot;CENTER&#95;DIALOG&quot; }); }); }      window.&#95;&#95;&#95;gcfg = { lang: 'en-US' };    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&#95;ID: A unique ID for the order (order number). CUSTOMER&#95;EMAIL: The customer's email address, in the format COUNTRY&#95;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, &quot;US&quot;. 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, &quot;2016-09-13&quot;. (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?")*

Hi,

The order number is available with the code: Code:

&lt;?php echo $this-&gt;order-&gt;order_number; ?&gt;

The customer email address is available with; Code:

&lt;?php echo $this-&gt;order-&gt;customer-&gt;user_email; ?&gt;

The country code is available with : Code:

&lt;?php echo $this-&gt;order-&gt;shipping_address-&gt;address_country-&gt;zone_code_2; ?&gt;

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: Code:

&lt;?php echo $this-&gt;order-&gt;XXX; ?&gt;

where XXX is the column name of the custom field.
If you want to use the order creation date, you can use such code: Code:

&lt;?php echo hikashop_getDate($this-&gt;order-&gt;order_created,'Y-m-d'); ?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84OTgwOTUtZ29vZ2xlLXJldmlldy1zdXJ2ZXktb3B0LWluLWludGVncmF0aW9uP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")**
- [![SolarMade's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar37282.jpg)](/forum/user/37282-solarmade "View SolarMade's Profile") Topic Author
- [ Offline](/forum/user/37282-solarmade)

Less More

- Posts: 31
- Thank you received: 3
-
-
- [](http://www.solarmade.com)
-

7 years 1 month ago [\#310560](#310560) by [SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")  Replied by *[SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")* on topic *[Google Review Survey Opt-In Integration](/forum/30-integrations/898095-google-review-survey-opt-in-integration#310560 "-- 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       window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { window.gapi.surveyoptin.render( { // REQUIRED &quot;merchant&#95;id&quot;: &quot;100618039&quot;, &quot;order&#95;id&quot;: &quot;ORDER&#95;ID&quot;, &quot;email&quot;: &quot;CUSTOMER&#95;EMAIL&quot;, &quot;delivery&#95;country&quot;: &quot;COUNTRY&#95;CODE&quot;, &quot;estimated&#95;delivery&#95;date&quot;: &quot;YYYY-MM-DD&quot;  // OPTIONAL &quot;products&quot;:&#91;{&quot;gtin&quot;:&quot;GTIN1&quot;}, {&quot;gtin&quot;:&quot;GTIN2&quot;&gt;}&#93;, &quot;opt&#95;in&#95;style&quot;: &quot;CENTER&#95;DIALOG&quot; }); }); }      window.&#95;&#95;&#95;gcfg = { lang: 'en-US' };    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&#95;ID: A unique ID for the order (order number). CUSTOMER&#95;EMAIL: The customer's email address, in the format COUNTRY&#95;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, &quot;US&quot;. 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, &quot;2016-09-13&quot;. (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?")*

Hi Nicolas,

Thanks for looking into this. We've been trying to implement the code in our view: checkout/end.php but Chrome DevTools is generating the error: "delivery_country cannot be empty!" when we run through checkout.

Could there be an issue with the variable for the country code, or any ideas what else could be causing this?

Here is the code snippet we are adding to the beginning of the checkout/end.php file.
*This attachment is hidden for guests.
Please log in or register to see it.*

Regards,
Ian C.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84OTgwOTUtZ29vZ2xlLXJldmlldy1zdXJ2ZXktb3B0LWluLWludGVncmF0aW9uP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86284
- Thank you received: 14263
-
-

7 years 1 month ago [\#310572](#310572) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Google Review Survey Opt-In Integration](/forum/30-integrations/898095-google-review-survey-opt-in-integration#310572 "-- 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       window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { window.gapi.surveyoptin.render( { // REQUIRED &quot;merchant&#95;id&quot;: &quot;100618039&quot;, &quot;order&#95;id&quot;: &quot;ORDER&#95;ID&quot;, &quot;email&quot;: &quot;CUSTOMER&#95;EMAIL&quot;, &quot;delivery&#95;country&quot;: &quot;COUNTRY&#95;CODE&quot;, &quot;estimated&#95;delivery&#95;date&quot;: &quot;YYYY-MM-DD&quot;  // OPTIONAL &quot;products&quot;:&#91;{&quot;gtin&quot;:&quot;GTIN1&quot;}, {&quot;gtin&quot;:&quot;GTIN2&quot;&gt;}&#93;, &quot;opt&#95;in&#95;style&quot;: &quot;CENTER&#95;DIALOG&quot; }); }); }      window.&#95;&#95;&#95;gcfg = { lang: 'en-US' };    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&#95;ID: A unique ID for the order (order number). CUSTOMER&#95;EMAIL: The customer's email address, in the format COUNTRY&#95;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, &quot;US&quot;. 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, &quot;2016-09-13&quot;. (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?")*

Hi,

The first thing that comes to mind is that the products in your cart didn't need shipping and thus there is no shipping address registered in the order. In such case, you can use the billing address country instead: Code:

&lt;?php echo $this-&gt;order-&gt;billing_address-&gt;address_country-&gt;zone_code_2; ?&gt;

Otherwise, you could try with: Code:

&lt;?php echo $this-&gt;order-&gt;shipping_address-&gt;address_country_code_2; ?&gt;

The following user(s) said Thank You: [SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84OTgwOTUtZ29vZ2xlLXJldmlldy1zdXJ2ZXktb3B0LWluLWludGVncmF0aW9uP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")**
- [![SolarMade's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar37282.jpg)](/forum/user/37282-solarmade "View SolarMade's Profile") Topic Author
- [ Offline](/forum/user/37282-solarmade)

Less More

- Posts: 31
- Thank you received: 3
-
-
- [](http://www.solarmade.com)
-

7 years 1 month ago [\#310605](#310605) by [SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")  Replied by *[SolarMade](/forum/user/37282-solarmade "View SolarMade's Profile")* on topic *[Google Review Survey Opt-In Integration](/forum/30-integrations/898095-google-review-survey-opt-in-integration#310605 "-- 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       window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { window.gapi.surveyoptin.render( { // REQUIRED &quot;merchant&#95;id&quot;: &quot;100618039&quot;, &quot;order&#95;id&quot;: &quot;ORDER&#95;ID&quot;, &quot;email&quot;: &quot;CUSTOMER&#95;EMAIL&quot;, &quot;delivery&#95;country&quot;: &quot;COUNTRY&#95;CODE&quot;, &quot;estimated&#95;delivery&#95;date&quot;: &quot;YYYY-MM-DD&quot;  // OPTIONAL &quot;products&quot;:&#91;{&quot;gtin&quot;:&quot;GTIN1&quot;}, {&quot;gtin&quot;:&quot;GTIN2&quot;&gt;}&#93;, &quot;opt&#95;in&#95;style&quot;: &quot;CENTER&#95;DIALOG&quot; }); }); }      window.&#95;&#95;&#95;gcfg = { lang: 'en-US' };    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&#95;ID: A unique ID for the order (order number). CUSTOMER&#95;EMAIL: The customer's email address, in the format COUNTRY&#95;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, &quot;US&quot;. 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, &quot;2016-09-13&quot;. (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?")*

Nicolas,

This line seems to have done the trick:
Code:

&lt;?php echo $this-&gt;order-&gt;shipping_address-&gt;address_country_code_2; ?&gt;

We are successfully generating the survey opt-in module at the end of checkout now. We'll know for certain if it is working when Google emails me the survey after a few days, I'll keep you updated with the results.

Thanks again for your help!
Ian

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84OTgwOTUtZ29vZ2xlLXJldmlldy1zdXJ2ZXktb3B0LWluLWludGVncmF0aW9uP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.207 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
