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