Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: Opt In Integration for Google Customer Reviews

Solved

Opt In Integration for Google Customer Reviews

AvyCoffee
Excursionist
23 0 7

Hello,

I am struggling with integrating the Google Customer Reviews Opt In and updating the <!DOCTYPE HTML>

I don't understand where things need to go. I have the <script> that I need to enter, but direction on where this goes would be extremely helpful.

 

I'm using Dawn theme 15.1.0

 

Thank you!

Accepted Solution (1)
EmmanuelFlossie
Shopify Partner
3457 264 833

This is an accepted solution.

@AvyCoffee just want to let you know that the other user's reply is AI.

 

Google Customer Reviews does not work with pixels (customer events), if you want to install it via additional scripts, add the below code. If you want to add it to pixels, then use a different review platform, here is a list of supported 3rd party aggregators: https://support.google.com/merchants/answer/7045996?hl=en

 

<!-- Copyright FeedArmy 2024 Version 1.05 -->
<!-- CODE SETTINGS START -->
<!-- CODE SETTINGS START -->

<!-- Please set merchant id -->
{% assign fa_merchant_id = 123456789 %}

<!-- Please set estimated delivery days -->
{% assign fa_delivery_days = 3 %}

<!-- CODE SETTINGS END -->
<!-- CODE SETTINGS END -->
{%- case shipping_address.country_code -%}
{%- when 'BG' -%}{%- assign fa_language = 'bg' -%}{%- when 'CZ' -%}{%- assign fa_language = 'cs' -%}{%- when 'DK' -%}{%- assign fa_language = 'da' -%}{%- when 'DE' -%}{%- assign fa_language = 'de' -%}{%- when 'GR' -%}{%- assign fa_language = 'el' -%}{%- when 'AU' -%}{%- assign fa_language = 'en-AU' -%}{%- when 'GB' -%}{%- assign fa_language = 'en-GB' -%}{%- when 'US' -%}{%- assign fa_language = 'en-US' -%}{%- when 'CA' -%}{%- assign fa_language = 'en-CA' -%}{%- when 'ES' -%}{%- assign fa_language = 'es' -%}{%- when 'FI' -%}{%- assign fa_language = 'fi' -%}{%- when 'FR' -%}{%- assign fa_language = 'fr' -%}{%- when 'HR' -%}{%- assign fa_language = 'hr' -%}{%- when 'HU' -%}{%- assign fa_language = 'hu' -%}{%- when 'ID' -%}{%- assign fa_language = 'id' -%}{%- when 'IT' -%}{%- assign fa_language = 'it' -%}{%- when 'JP' -%}{%- assign fa_language = 'JA' -%}{%- when 'KR' -%}{%- assign fa_language = 'ko' -%}{%- when 'LT' -%}{%- assign fa_language = 'lt' -%}{%- when 'LV' -%}{%- assign fa_language = 'lv' -%}{%- when 'MY' -%}{%- assign fa_language = 'ms' -%}{%- when 'BE' -%}{%- assign fa_language = 'nl' -%}{%- when 'NL' -%}{%- assign fa_language = 'nl' -%}{%- when 'NO' -%}{%- assign fa_language = 'no' -%}{%- when 'PL' -%}{%- assign fa_language = 'pl' -%}{%- when 'BR' -%}{%- assign fa_language = 'pt-BR' -%}{%- when 'PT' -%}{%- assign fa_language = 'pt-PT' -%}{%- when 'RO' -%}{%- assign fa_language = 'ro' -%}{%- when 'RU' -%}{%- assign fa_language = 'ru' -%}{%- when 'SK' -%}{%- assign fa_language = 'SK' -%}{%- when 'SI' -%}{%- assign fa_language = 'sl' -%}{%- when 'RS' -%}{%- assign fa_language = 'sr' -%}{%- when 'SE' -%}{%- assign fa_language = 'sv' -%}{%- when 'TH' -%}{%- assign fa_language = 'th' -%}{%- when 'TR' -%}{%- assign fa_language = 'tr' -%}{%- when 'VN' -%}{%- assign fa_language = 'vi' -%}{%- when 'CN' -%}{%- assign fa_language = 'zh-CN' -%}{%- when 'TW' -%}{%- assign fa_language = 'zh-TW' -%}
{%- else -%}
{%- assign fa_language = 'en' -%}
{%- endcase -%}

{% assign fa_delivery_seconds = 86400 | times: fa_delivery_days %}
<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(
        {
          "merchant_id": {{ fa_merchant_id }},
          "order_id": "{{ order.order_number }}",
          "email": "{{ order.email }}",
          "delivery_country": "{{ order.shipping_address.country_code }}",
          "estimated_delivery_date": "{{'now' | date: '%s' | plus : fa_delivery_seconds  | date: '%Y-%m-%d' | uri_encode | replace:'+','%20'}}",
          "products": [{%- for item in order.line_items -%}{%- if item.variant.barcode != blank -%}{"gtin":"{{ item.variant.barcode }}"}{%- unless forloop.last -%},{%- endunless -%}{%- endif -%}{%- endfor -%}]
        });
        window.___gcfg = {
          lang: '{{ fa_language }}'
        };
    });
  }
</script>
<!-- Copyright FeedArmy 2024 Version 1.05 -->

 

 

Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.

View solution in original post

Replies 7 (7)
AvyCoffee
Excursionist
23 0 7

Thank you, Oliver. Unfortunately, these steps go over my head. I can usually figure things out, but I'm not able to with this for whatever reason. 

1. I don't see an option on my checkout settings page to add a custom script or HTML.

2. I don't really know anything about the DOCTYPE. I'm not sure where to locate that.

 

I have the code needed, but I'm struggling with finding where to add this code.

 

I am using the Dawn theme, 15.1.0 and I'm not seeing options to add code and/or I don't know where in the code to put it.

 

Thank you for your help!

AvyCoffee
Excursionist
23 0 7

I am ready when you are. Thank you so much!

EmmanuelFlossie
Shopify Partner
3457 264 833

This is an accepted solution.

@AvyCoffee just want to let you know that the other user's reply is AI.

 

Google Customer Reviews does not work with pixels (customer events), if you want to install it via additional scripts, add the below code. If you want to add it to pixels, then use a different review platform, here is a list of supported 3rd party aggregators: https://support.google.com/merchants/answer/7045996?hl=en

 

<!-- Copyright FeedArmy 2024 Version 1.05 -->
<!-- CODE SETTINGS START -->
<!-- CODE SETTINGS START -->

<!-- Please set merchant id -->
{% assign fa_merchant_id = 123456789 %}

<!-- Please set estimated delivery days -->
{% assign fa_delivery_days = 3 %}

<!-- CODE SETTINGS END -->
<!-- CODE SETTINGS END -->
{%- case shipping_address.country_code -%}
{%- when 'BG' -%}{%- assign fa_language = 'bg' -%}{%- when 'CZ' -%}{%- assign fa_language = 'cs' -%}{%- when 'DK' -%}{%- assign fa_language = 'da' -%}{%- when 'DE' -%}{%- assign fa_language = 'de' -%}{%- when 'GR' -%}{%- assign fa_language = 'el' -%}{%- when 'AU' -%}{%- assign fa_language = 'en-AU' -%}{%- when 'GB' -%}{%- assign fa_language = 'en-GB' -%}{%- when 'US' -%}{%- assign fa_language = 'en-US' -%}{%- when 'CA' -%}{%- assign fa_language = 'en-CA' -%}{%- when 'ES' -%}{%- assign fa_language = 'es' -%}{%- when 'FI' -%}{%- assign fa_language = 'fi' -%}{%- when 'FR' -%}{%- assign fa_language = 'fr' -%}{%- when 'HR' -%}{%- assign fa_language = 'hr' -%}{%- when 'HU' -%}{%- assign fa_language = 'hu' -%}{%- when 'ID' -%}{%- assign fa_language = 'id' -%}{%- when 'IT' -%}{%- assign fa_language = 'it' -%}{%- when 'JP' -%}{%- assign fa_language = 'JA' -%}{%- when 'KR' -%}{%- assign fa_language = 'ko' -%}{%- when 'LT' -%}{%- assign fa_language = 'lt' -%}{%- when 'LV' -%}{%- assign fa_language = 'lv' -%}{%- when 'MY' -%}{%- assign fa_language = 'ms' -%}{%- when 'BE' -%}{%- assign fa_language = 'nl' -%}{%- when 'NL' -%}{%- assign fa_language = 'nl' -%}{%- when 'NO' -%}{%- assign fa_language = 'no' -%}{%- when 'PL' -%}{%- assign fa_language = 'pl' -%}{%- when 'BR' -%}{%- assign fa_language = 'pt-BR' -%}{%- when 'PT' -%}{%- assign fa_language = 'pt-PT' -%}{%- when 'RO' -%}{%- assign fa_language = 'ro' -%}{%- when 'RU' -%}{%- assign fa_language = 'ru' -%}{%- when 'SK' -%}{%- assign fa_language = 'SK' -%}{%- when 'SI' -%}{%- assign fa_language = 'sl' -%}{%- when 'RS' -%}{%- assign fa_language = 'sr' -%}{%- when 'SE' -%}{%- assign fa_language = 'sv' -%}{%- when 'TH' -%}{%- assign fa_language = 'th' -%}{%- when 'TR' -%}{%- assign fa_language = 'tr' -%}{%- when 'VN' -%}{%- assign fa_language = 'vi' -%}{%- when 'CN' -%}{%- assign fa_language = 'zh-CN' -%}{%- when 'TW' -%}{%- assign fa_language = 'zh-TW' -%}
{%- else -%}
{%- assign fa_language = 'en' -%}
{%- endcase -%}

{% assign fa_delivery_seconds = 86400 | times: fa_delivery_days %}
<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(
        {
          "merchant_id": {{ fa_merchant_id }},
          "order_id": "{{ order.order_number }}",
          "email": "{{ order.email }}",
          "delivery_country": "{{ order.shipping_address.country_code }}",
          "estimated_delivery_date": "{{'now' | date: '%s' | plus : fa_delivery_seconds  | date: '%Y-%m-%d' | uri_encode | replace:'+','%20'}}",
          "products": [{%- for item in order.line_items -%}{%- if item.variant.barcode != blank -%}{"gtin":"{{ item.variant.barcode }}"}{%- unless forloop.last -%},{%- endunless -%}{%- endif -%}{%- endfor -%}]
        });
        window.___gcfg = {
          lang: '{{ fa_language }}'
        };
    });
  }
</script>
<!-- Copyright FeedArmy 2024 Version 1.05 -->

 

 

Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.
AvyCoffee
Excursionist
23 0 7

Thank you for the heads up, Emmanuel. Can you let me know where inside the code I need to add it as an additional script?

EmmanuelFlossie
Shopify Partner
3457 264 833

Just at the bottom is fine. Meaning after all the other coding, if you have any.

Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.
AvyCoffee
Excursionist
23 0 7

Apologies for my ignorance. Which section of the coding is it supposed to go? theme.liquid?

EmmanuelFlossie
Shopify Partner
3457 264 833

Additional scripts, go to settings > checkout > additional scripts

Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.