This section includes the following topics:
- Integration instructions
- Ensure that your Google Customer Reviews opt-in snippet has the 'products' line
Integration instructions
We'll need to collect GTINs (Global Trade Item Numbers) for products included in orders placed on your site. In order to do this, you may need to add a few lines of code to the Google Customer Reviews opt-in module JavaScript snippet on your site. Note that GTINs are required for collecting product ratings through Google Customer Reviews.
Ensure that your Google Customer Reviews opt-in snippet has the 'products' line
If you're just beginning your integration, make sure that you include the optional field 'products' line. If you've integrated previously, find the Google Customer Reviews opt-in module snippet in your site's source code. Below the '// OPTIONAL FIELDS' or '// OPTIONAL' section, ensure that your code has the 'products' line. If not, you'll need to add it, as seen below.
<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 FIELDS
"merchant_id": 117246064,
"order_id": "ORDER_ID",
"email": "CUSTOMER_EMAIL",
"delivery_country": "COUNTRY_CODE",
"estimated_delivery_date": "YYYY-MM-DD",
// OPTIONAL FIELDS
"products": [{"gtin":"GTIN1"}, {"gtin":"GTIN2"}]
});
});
}
</script>