How to Add GA4 (Google Analytics 4 ver 2021) to Shopify site?

Posted

by

Fumbled my way here and there but here’s how I figured it out:

  1. Create new property
  2. Copy the Global Tag settings
    How to Add GA4 (Google Analytics 4 ver 2021) to Shopify site?The old way is getting UA-xxx, plug the code inside using Online Store > Preferrence > Google Analytics. It doesn’t work that way anymore, insead, you will get this error.This is where I started tinkering around and finally insert the tag. Read on….
  3. Go to Oneline Store > Theme > Edit Code. BE VERY VERY CAREFUL HERE!!!!
    How to Add GA4 (Google Analytics 4 ver 2021) to Shopify site2?
  4. Template.liquid . Look for head opening code line. Paste in there.  where to install GA4 on shopify site?
  5. Once you copy-paste it. It should be total of 9 lines. SAVE of course!
  6. TEST:
    Use Google Chrome extension – TAG manager by Google.
    6.1 Hit Enable.
    6.2 Refresh
    6.3 Check installation / trackers
    test if GA4 tag is installed in the shopify websiteABOVE WORKS for a Corporate site and IF your website is in WORDPRESS. However, if your site is on SHOPIFY – continue to Step 7:
  7.  Ecommerce sales data variables such as order ID, currency total price, shipping price, tax and sending it to Google Analytics 4 to record the sales. Paste it here:
    Copy the code from below. The code is generated by Analyzify using your GA4 Measurement ID. It also include Ecommerce sales data variables such as order ID, currency total price, shipping price, tax and sending it to Google Analytics 4 to record the sales.
  8. Move to Debug & Verification

 

Voila!

If you missed out #7, here’s how your Google Anlaytics Ga 4 dashboard will look like:

ga4 shopify purchase ecommerce not recording

 

P.s. I hit a bump on this. what helped me a lot is this video: