Shopify Custom web Pixel Questions

Hello,

I have couple of questions about the how the Shopify Custom Pixels interact with the pixels on the theme layout file.

  1. If I have added a Google Adwords pixel on the theme layout file and then added the Adwords Conversion code in the Custom pixels for the checkout_completed to fire a purchase event for Google, will it still work or do I need to put everything under webpixel.

  2. If I have add the a script in the custom webpixel without any event checking, will it fire on all the pages ( equivivalent to page_view) and then add the customer conversion code under if statement for checkout_comleted that will only fire if the order status is checkout_completed. Is that a good practice?

// Load the Google Adwords script asynchronously
(function() {
    var gtagScript = document.createElement('script');
    gtagScript.async = true;
    gtagScript.src='https://www.googletagmanager.com/gtag/js?id=AW-XXX';
    document.head.appendChild(gtagScript);
})();

// Initialize the dataLayer and gtag function
window.dataLayer = window.dataLayer || [];
function gtag() {
    dataLayer.push(arguments);
}

// Execute the gtag function to set up Google Analytics
gtag('js', new Date());
gtag('config', 'AW-XXX');

//Checkout Completed code 
analytics.subscribe("checkout_completed", (event) => {
gtag('event', 'conversion', {
      'send_to': 'AW-XXX/YYY',
      'value': event.data.checkout.totalPrice.amount,
      'currency': event.data.checkout. currencyCode',
      'transaction_id': event.data.checkout.order_number,
  });
})

Hello Rknr,

I would recommend you to enable the datalayer on the Shopify website and track the conversion via Google tag manager.

Datalayer helps to create an event and send event data to GTM to track the purchase journey of a users. like page view, view content, add to cart, begin checkout, add payment info, and purchase.

From Datalayer event you can send tracking data to any kind of platform like facebook pixel, google analytics 4, google ads, google ads remarketing, tiktok pixel and so on.

Feel free to ask any question you may have.

Thanks

Thanks