Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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?
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?
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.
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024