How do we install Google Merhcant Center Opt-In Script now that "checkout scripts" is Deprecated?

liquidwebmaster
Shopify Partner
3 0 1

Consider the following very simple script

which must appear on the order confirmation page

to trigger the Google Merchant Center OPT IN script for Top Quality stores:

liquidwebmaster_0-1717375739567.png

 

Traditionally we have just simply added this into SETTINGS->CHECKOUT->ADDITIONAL SCRIPTS

and it has worked fine... (till now)

 

Here is the official documentation:

https://support.google.com/merchants/answer/14629205

The survey opt-in module is the only way to collect PRODUCT reviews that show up in GoogleShopping.

 

However, now that the "Order status page additional scripts" are Deprecated

liquidwebmaster_1-1717375903543.png

 

There is no easy way I can see here to integrate the script.

 

I don't see any "blocks" that allow me to add Javascript with inline liquid

(correct me if I am wrong please, I have tried making custom blocks, but they do not allow JS)

liquidwebmaster_2-1717376085001.png

 

There do not appear to be any apps that allow us to inline a simple script

https://apps.shopify.com/search?q=checkout%20script 

 

I know that for $2300 per month (using ShopifyPlus) this can be easily done.

However, for all clients that are using anything less than ShopifyPlus I see no solution that allows us to "just copy in the simple code" needed. (other than making our own custom Shopify App for every client)

 

I really feel like I must be missing something here?

 

The documentation for Pixel creation does not allow us to pull in any external scripts

https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels

 

The overview page seems to be an elaborate way to say: "you can not pull in external scripts"

https://help.shopify.com/en/manual/promoting-marketing/pixels/overview

 

Surely...

there must be a way to handle this simple embed from Google Merchant Center on the order confirmation page?

 

liquidwebmaster_3-1717376511815.png

 

 

 

Replies 8 (8)

Sonya_2025
Shopify Partner
177 24 39

Hey @liquidwebmaster 

 

You might consider using a custom pixels here

 

Sonya_2025_0-1717381625846.png

 

Please let me know if it works by giving it a Like or marking it as a solution!
Feel free to reach out. EMAIL ME  
Motivate me by  PAY ME
liquidwebmaster
Shopify Partner
3 0 1

that does not work. 

Pixel Apps do not allow us to sideload the required embed script: https://apis.google.com/js/platform.js?onload=renderOptIn

 

That OptIn endpoint is not accessible via Google APIs
We are able to write the code needed to tap into the liquid variables by making our own custom pixel, 
however, there is no API to "send" them to via Google
 
nor do custom pixels allow us to load in the platform.js?onload=renderOptIn dependency from apis.google.com
 
There are no PIXEL Apps for this scenario. 
(correct me if I am wrong, the truth is more important to me than thinking I am right)
 

The documentation for Pixel creation does not allow us to pull in any external scripts

https://shopify.dev/docs/apps/build/marketing-analytics/build-web-pixels

 

The overview page seems to be an elaborate way to say: "you can not pull in external scripts"

https://help.shopify.com/en/manual/promoting-marketing/pixels/overview

 

Here is the official documentation:

https://support.google.com/merchants/answer/14629205

The survey opt-in module is the only way to collect PRODUCT reviews that show up in GoogleShopping.

 

Please read those or, why reply at all?

Try it.

Try to get the GOOGLE OPT IN SURVEY to "popup" on the checkout screen. lol.

you'll see the problem...

 

I predict if you actually try it, and read the docs, there is a 90% chance you will reply:

"Oh, ok. Yea, Google is going to have to update their official Shopify Channel to fix that."

Sonya_2025
Shopify Partner
177 24 39

Hey @liquidwebmaster 

You can import external script like below, it is a just simple example for google opt-in pixel

// Step 1. Initialize the JavaScript pixel SDK (make sure to exclude HTML)
const script = document.createElement('script');
script.setAttribute('src', 'https://apis.google.com/js/platform.js?onload=renderOptIn');
script.setAttribute('async', '');
document.head.appendChild(script);



// Step 2. Subscribe to customer events with analytics.subscribe(), and add tracking
 analytics.subscribe("surveyoptin", event => {
   // pixel("track", "event_name", event.data);
         window.gapi.surveyoptin.render(
        {
          // REQUIRED FIELDS
          "merchant_id": xxxxxxxxx,
          "order_id": event.data.order_number,
          "email": event.data.email,
          "delivery_country": event.data.country_code,
          "estimated_delivery_date": event.data.delivery_date,
          // OPTIONAL FIELDS
          "products": [{"gtin":"GTIN1"}, {"gtin":"GTIN2"}]
        });
 });

 

You might wonder how to get the event.data?

To get the data from the event,  you need to publish the custom event first using checkout extension, pls refer this.

I am not sure if it will work?

But you can have a try.

 

 

Please let me know if it works by giving it a Like or marking it as a solution!
Feel free to reach out. EMAIL ME  
Motivate me by  PAY ME
c_zagarskas
Excursionist
22 1 23

We have tried things like this...

 

 

document.head.appendChild(script);

 

 

They do not seem to work in SANDBOXED JS for all situations,

https://apis.google.com/js/platform.js?onload=renderOptIn

being one of them

 

We have also tried to test/debug, we also have a GTM integration.

Alas... SANDBOXED JS seems to cause the embed to fail.

 

We will give it another shot, I can see there are some variations in the syntax you are proposing here in your code sample.

This is a good reply - thank you for that.

 

However, problems like this: https://www.youtube.com/watch?v=OMt5d7DxgqA

still remain and prevent us from testing/debugging.

 

On top of this, I deeply understand why Shopify has done this. Its a good idea. lol

But now, I think we need Google to change their code. which is not as easy as just asking...

 

Eric-HAN
Shopify Partner
46 8 3

 

Hi, there 

I think you could use post purchase page instead and have a try

- Helpful? Please hit Like and mark it as a solution
- Feel free to contact me iyouandhim@gmail.com

dpeugeot
Visitor
1 0 1
Thank you @liquidwebmaster for calling this out. This IS A PROBLEM, please update the Google Shopify App so we can correctly collect product reviews and track purchases. 
That feature should already be included by default in the Official Google-Shopify app. Please update ASAP, this a causing a problem for us.

DocClemens
Visitor
1 0 1
Agree this is absolutely an issue.  Need an update to the Google Shopify App so we can properly collect reviews and track purchases. 
It's causing problems for our store. That feature should already be included by default in the Official Google-Shopify app.  Please update asaP.

MTIdev1234
Visitor
1 0 1

We see this issue too. Need update to the Google Shopify App so we can correctly collect product reviews and track purchases. 

That feature should already be included by default . It's causing problems for our store. Please update,