ga4 for ecommerce

A Step-by-Step Guide for GA4 For Ecommerce Sites

The transition to GA4 can be challenging. But Here’s a step-by-step method for GA4 for eCommerce to help eCommerce businesses avoid the Google UA Sunset. The loss of Universal Analytics is bad news for all marketers who use Google Analytics on a regular basis to track traffic, behavior, attribution, and other metrics. Especially in the case of eCommerce.

GA4 isn’t like any other software upgrade. It’s an entirely different platform, and installing GA4 on eCommerce sites is no longer as simple. The following is a step-by-step guide on configuring GA4 for eCommerce.

 

How to work with GA4 for eCommerce businesses

  1. Basic Configuration of GA4 for eCommerce

The transition to GA4 is understandably challenging. It doesn’t help the deployment procedures differ significantly from what we’re used to with Universal Analytics. The good news is that GA4 includes a slew of previously inaccessible functionality. You’ll need to install GA4, create a purchase data layer, and develop a product view data layer to get started. You’ll need to build tags to transport data from your website to your Google Analytics account after you’ve created the GA4 property. GA4 can be configured on your shop site using either the Global Site Tag (gtag.js) or Google Tag Manager (GTM). Once GA4 is set up, you’ll see that the GTM container is insufficient for eCommerce stores. To make our eCommerce reports work, we’ll need to add a data layer, that will feed purchase and product view information to Google Analytics.

  1. Purchase Data Layer

The purchase data layer sends variables to Google Tag Manager when a customer completes an order. The data points we wish to track are called variables, and they include revenue, tax, and shipping information. Setting up a purchase data layer consists of four steps:

  • Organizing a one-of-a-kind event.
  • Creating a variable in the data layer.
  • In GTM, make a new tag.
  • Make a code for the Purchase Data Layer.

To the Checkout Page, Add A Purchase Data Layer and Select “Checkout” from the left-hand menu after clicking on Admin Settings. Scroll down to “Order Status Page.” Copy the code from Additional scripts and paste it into the GTM container snippet.

In GTM, create a custom purchase event trigger

Google Tag Manager may now access your purchase data layer. Copy the custom event from your data layer code and create a GTM account. To create a new trigger, click the blue button in the upper right corner.  Select a custom event from the options on the screen to configure the trigger. It’s a good idea to test at this point before building out the rest of your GTM to make sure the data layer is operating properly. Wait for the screen to say “Connected!” once you enter your site’s URL. Complete a test purchase and look for the new event trigger in Tag Assistant.

Make Variables in the Data Layer

Go back to your GTM workspace and select Variables. You’ll notice built-in variables as well as any variables you’ve set earlier. To make a new user-defined variable, click the + button. Select the Data Layer Variable option when choosing the variable type. The name value of the Data Layer Variable must exactly match what is in your data layer; else, it will not work. 

Send Conversions to GA4

Now you must send this purchase data to your Google Analytics account so that your marketing team may begin analyzing reports. To configure your new tag, give it a name and click within the body of the first card. Choose a tag type and the Configuration tag for your GA4 Global Tag. For the variables in our data layer, we’ll add event parameters.  To add a data layer variable, either click the + icon to bring up a popup with all of the available variables or type double brackets to bring up a dropdown with all of your selections. 

  1. Product View Data Layer

We’ll need to add a second data layer to Google Tag Manager to acquire product-level metadata. The Shopify theme.liquid file will be updated to include the product view data layer. In GTM, we’ll create a data layer code, make a custom event, make data layer variables, and make a new trigger.

To Theme Files, Add A Product Data Layer

You’ll need to change your theme files to communicate product information to GA4. Because Shopify retains change history, making changes to your theme file is relatively risk-free. However, if you’re hesitant, you may always work with a duplicate of the live theme. Click Online Store in your Shopify Admin panel.

Choose a live theme from the drop-down menu under Themes and Add a new snippet by clicking on Add new snippet called GTM-product-data-layer. Search for “/head” in the theme.liquid file and save your work.  It’s now time to see if the product data layer is correctly providing information about our product views to Google Tag Manager. Conduct a test purchase and click on this custom event.

  1. Create Product Detail View Trigger

Google Tag Manager can access your Shopify product view data layer. Open Google Tag Manager and then to Triggers, and click “Add New.” Choose “Custom Event” from the trigger options and Add the field for the custom event now. 

Variables in GTM

Select Variables from the GTM left-hand menu, then New under User-Defined Variables. It’s critical to match the text to your data layer accurately when adding GTM variables. 

  1. Make a product view event tag

Return to Google Tag Manager and create a new tag and select a tag type. You’ll need to add event parameters to GA4 as well. The first parameter is item id, and the associated variable can be found by clicking the plus icon or by using a double bracket, which will bring up a dropdown list. 

Ecommerce Debugging with GA4

It’s time to double-check that everything is working properly. Open GTM preview and type in the URL of your website. View products, add them to a basket, and finish a purchase after the GTM preview tool is linked. In Google Tag Assistant, view and buy view event tags to trigger. Click on the custom purchase event to see the API call specifics. This implies that GTM receives information on your Shopify store’s eCommerce product views and transactions.

The final step is to verify that all event parameters and items array is operating properly in GA4 Debugger. Click Configure > DebugView in the left-hand menu navigation and see the timeline of your activity. Then double-click products to confirm that the purchase event is transmitting product item information to GA4. 

Final Thoughts

We used GA4 tags to deliver revenue, tax, shipping, product name, brand, and category information. Remember to test using the GTM preview and GA4 debugging tools. It could take up to 48 hours for your normal reports to appear. GA4 for eCommerce business is a developing product, and I’m hoping that if third-party platforms, such as Shopify, make changes, eCommerce tracking will get easier.

SHARE THIS POST