To set up Google Analytics 4 (GA4) in Shopify, follow these steps:
- Sign in to your Shopify account and navigate to the Shopify admin dashboard.
- Go to “Online Store” and select “Preferences.”
- Scroll down to the “Google Analytics” section and click on “Add Google Analytics.”
- In the “Add custom JavaScript” section, enter your GA4 Measurement ID. The Measurement ID looks like “G-XXXXXXXXXX”. If you don’t have a GA4 property set up yet, you’ll need to create one in the Google Analytics interface first.
- Check the “Use Enhanced Ecommerce” box if you want to enable enhanced ecommerce tracking. This will provide you with more detailed data about user behavior on your Shopify store.
- Click “Save” to apply the changes.
- Shopify will automatically add the necessary tracking code to your store’s theme.liquid file. You don’t need to manually modify any code.
- To verify the installation, you can visit your Shopify store and view the page source code (right-click and select “View Page Source” or “Inspect”). Look for the GA4 tracking code that starts with “gtag(‘config’, ‘G-XXXXXXXXXX’);” to ensure it’s present.
Once the setup is complete, GA4 will start tracking data from your Shopify store. Keep in mind that it may take a few hours or more for the data to appear in your GA4 reports. You can access your GA4 reports by logging in to your Google Analytics account and navigating to the GA4 property associated with your Shopify store.