Deploy Analytics via tags in Google Tag Manager and add the below code to Shopify Admin > Online Store > Preferences > Additional Google Analytics Javascript
var trackanalyticswithShopify = 0; if (window.location.href.includes('checkouts') == true) { trackanalyticswithShopify = 1; checkoutpage = 1; } else { checkoutpage = 0; } if (checkoutpage == 1) { if (window.location.href.includes('thank_you') == true) { trackanalyticswithShopify = 0;} if (window.location.href.includes('orders') == true) { trackanalyticswithShopify = 0;} } if (trackanalyticswithShopify == 0) { ga('remove');} window.localStorage.setItem("ecommercetrackingtype", "ee");
An example configuration is shown below - ensure that you use your own Google Analytics Account Tracking ID that starts with UA-
Although not shown here, please ensure that the Use Enhanced Ecommerce box has a tick in it if you would like to enable enhanced ecommerce in Analytics