All things Shopify and commerce
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!
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!
I am ready when you are. Thank you so much!
@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 -->
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?
Just at the bottom is fine. Meaning after all the other coding, if you have any.
Apologies for my ignorance. Which section of the coding is it supposed to go? theme.liquid?
Additional scripts, go to settings > checkout > additional scripts
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024