What's your biggest current challenge? Have your say in Community Polls along the right column.

Custom Pixel for GOOGLE MERCHANT CENTER SURVEY

Custom Pixel for GOOGLE MERCHANT CENTER SURVEY

c_zagarskas
Excursionist
24 1 27

Consider this integration:

https://support.google.com/merchants/answer/14629205?hl=en

 

To Integrate the GOOGLE MERCHANCT CENTER survey opt-in module via a Shopify CUSTOM PIXAL we need to include this external script:

 

<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer> </script>

 

 

 

IN theory, the custom pixel would look something like this:

 

analytics.subscribe("checkout_completed", (event) => {

  window.dataLayer.push({
   event: "checkout_completed",
   /// other values here
  });


// then, we set up our render script
// this is needed: https://apis.google.com/js/platform.js?onload=renderOptIn

// now, we have to add on about 7 days: 
var d = new Date(); // today
d.setSeconds(d.getSeconds() + 604800); // add about 7 days
var estimatedDelivery = (d).toISOString().split('T')[0]; // ie: 2024-11-29

//old way in liquid was as follows: 
//checkout.created_at | date: "%s" | plus : 604800 | date: "%Y-%m-%d" | uri_encode | replace:"+","%20"}}
  
// now render the opt in
  window.renderOptIn = function() {
    window.gapi.load('surveyoptin', function() {
      window.gapi.surveyoptin.render(
        {
          "merchant_id": GMC_ACCOUNT, // set manually
          "order_id": event.data.checkout.order.id,
          "email": event.data.checkout.email,
          "delivery_country": event.data.checkout.shippingAddress.countryCode,
          "estimated_delivery_date": estimatedDelivery,
        });
    });
  }
}
// end opt in


 // end checkout_completed event
});

 

 

 

However, I don't see any way to INJECT https://apis.google.com/js/platform.js?onload=renderOptIn into that pixel code on the checkout page.

 

GoogleMerchantCenter support tells me the Render Survey is not included in the Google Channel.

 

We can see this to be true, because after switching to custom pixels using the GTM method here: https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/gtm-tutorial NONE of our surveys are getting sent out from GoogleMerchant Center 

 

Any ideas?

How can we get that JS file from Google to be injected into the checkout page?

 

Replies 2 (2)

Sam49
Shopify Partner
7 0 5

Hey there, we had the same issue. We run the Google customer reviews app and when the new Checkout extensibility came in we had no way to inject the js into the order status page. It's not the most ideal solution but we built the ability to drop a checkout block into the OSP asking the customer if they want to opt into Google reviews. If they select yes, we redirect them to a proxy page, where we can fire the JS script: https://apps.shopify.com/easy-google-customer-reviews.

 

Hope that helps?

EmmanuelFlossie
Shopify Partner
3465 264 834

Pixels / Customer events, don't allow pop-ups and the Google Customer review shows a pop up. As such shopify blocks the function to run. It's a big issue, with no solution using pixels, you will need to use alternate methods. Seems Sam found a option.

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?.