Table of contents

How do you create (E-commerce) events in Google Tag Manager?

e-commerce-tracking

If you have an online store, tracking the performance of your online store is essential to optimize your sales strategy. With Google Tag Manager, you can create GA4 e-commerce events to track, for example, the completion of a purchase, adding a product to the cart, or starting a checkout. Measuring events is not only interesting for web shops, but also for business websites. For example: measuring completed job application forms, or demo requests.

In this blog, we will explain step by step how to create events in the web container in Google Tag Manager so that you can get better insight into the performance of your web shop/website and improve your marketing strategy to achieve more sales and growth.

See the entire GA4 Server Side Tracking setup for more information.

Note: This blog is not about server side event tagging. The events are created client side in this blog. In the next parts of the GA4 implementation series, we will be tracking events server side.

We assume that you have already created a Google Tag Manager account. If you are looking for a description on how to create a Google Tag Manager account, check out this article.

We'll show you examples for building events in this blog. Want to see preset GTM templates where all the events are already set up for you? Then check out our TAGGRS Template Gallery.

What events can you measure?

There are currently 14 e-commerce events (events) that you can measure. Below is a table of which events these are and their description.

GA4 actionDescription
view_item_list
Someone sees a product listing.
select_itemSomeone selects a product within the overview.
view_itemSomeone visits a product page.
add_to_cartSomeone adds a product to the shopping cart.
remove_from_cartSomeone removes a product from the shopping cart.
view_cartSomeone looks at the shopping cart.
add_to_wishlistSomeone adds a product to a wishlist.
start_checkoutSomeone starts to checkout.
add_shipping_infoSomeone chooses a shipping option.
add_payment_infoSomeone chooses a payment option.
purchaseSomeone placed an order.
refundSomeone canceled an order (in part).
view_promotionSomeone looked at a promotion.
select_promotionSomeone selected a promotion.

There are also numerous options for tracking other events:

GA4 actionDescription
application
Someone fills out an application form.
call_to_clicksSomeone clicks on a phone number on your website.
call_to_mailSomeone clicks on an e-mail address on your website.
formSomeone fills out a form on your website.
demo_requestSomeone requests a demo appointment on your website.

For the e-commerce events you need a GA4 datalayer. You can install this manually using the official GA4 documentation, or you can use a plugin or extension. For example:

For business events, you don't need a special data layer, in that you can use the data that is automatically available in Google Tag Manager. In the remainder of this blog we will specifically discuss measuring e-commerce events. Want to know more about creating custom events for your business website. Then watch this video. Once you have the events set up, continue to this blog.

Creating e-commerce events in Google Tag Manager

Once you've determined which events you want to measure, it's time to create the e-commerce events in Google Tag Manager.

Step 1: Create Trigger

Go to the workspace in GTM and open the 'Triggers' tab and click 'New'.

configure build in variables gtm 3

Step 2: Choose type of trigger

Click the pencil under 'Trigger Configurations' and choose 'Custom Event' as the trigger type (under other).

choose trigger type

Step 3: Add event

Under 'Name of event' enter the name of the event you want to measure (exactly as named in the datalayer, use debug mode to find out). Then select 'Some custom events'. Enter here: Event - Equals - . Click on 'Save'.

trigger gtm

You have now created an e-commerce event on Google Tag Manager, good job!

Step 4: Create additional variables (optional)

You can send additional data to GA4 in addition to the events. When you have configured the data layer correctly, it sends all kinds of additional data about the products to GTM. You can use this for more insight. The following variables can be sent along with the datalayer:

Datalayer variableDescription
currency
Currency of price.
valueThe value associated with the event.
itemsProducts associated with the event.
transaction_idUnique ID for the transaction. Required for purchase and refund events.
couponDiscount coupon associated with the event.
affiliationThe store or affiliate where the purchase took place.
payment_typeThe payment method sent with add_payment_info
shippingShipping costs included in total sales of purchase.
shipping_tierThe shipping category used with add_shipping_info.
taxHow much tax is included in the total sales of the purchase.

This list is not all-encompassing, but to keep it organized, we limit ourselves to this list.

Note! These variables are based on a standard GA4 DataLayer. In Google Tag Manager preview mode, see how your DataLayer is built. In the video below, we show you how to do this.

To send these parameters along with the events we created in steps 2 and 3, we first go to variables in GTM:

Click on 'New' here . Select 'Variable for data layer'. Here you can extract the values of the variables from the data layer so that you can use them for your tracking. Name the variables in the 'Name of variable for data layer' field .

variables-google-tag-manager

Naming variables works like this: you name the parameter you want to track by naming its path in the datalayer code from left to right, separated by a dot. What do we mean by this? Suppose we want to measure the paramater 'value' in this datalayer:

data-layer-example-ecommerce

We then call it ecommerce.value, because the leftmost parameter is e-commerce and on the next line is value.

By checking how the Data Layer comes in in the example mode, you can discover for each parameter how to name it as a variable in GTM. In the example below, you can see that the price of a product comes in as ecommerce as price. Therefore, we should also name it as a variable ecommerce.price.

Creating B2B events in Google Tag Manager

To track B2B events with Google Tag Manager, start by using built-in variables that GTM already provides. These variables automatically capture actions such as form fields being filled out or clicking on a phone number. The benefit of this is that you often don't need to add an additional datalayer to track these events, which streamlines the process.

First, go to the Variables section in GTM, where you'll find the Built-in Variables option. Here you click Configure to select the variables you need for tracking your events. These can range from clicking on a phone number to filling out a contact form.

Built in variables

Next, set up triggers for the B2B events you want to measure. You do this by going to Triggers and creating a new trigger. Give the trigger a clear name, such as GA4 Event contact form, and choose Form submission as the trigger type. Here you select All Forms to ensure that the trigger becomes active for every form completed on your site.

GA4-Event-contact-form-trigger

After setting up your triggers, the next step is to create the tags associated with these triggers. You go to Tags and create a new tag. Choose the type of Google Analytics: GA4 Event. Here you enter your Measurement ID and give the event a name, such as contact form. Then you link this tag to the trigger you created earlier.

ga4-event-contactform-gtm

What's next?

You have now created events and variables so you can use e-commerce data for measurements in GA4 or other platforms. The next step in the GA4 implementation series will teach you how to send these events and variables to GA4 by creating a GA4 Event tag.

Frequently asked questions creating events

Is it possible to implement Server Side Tracking without events, for example just with a thank you page?

Absolutely, it is possible to apply Server Side Tracking without using events, as in the case of a thank you page. However, it is important to note that in such a configuration the functionality for enhanced conversions will not be available. Specific events are required to take advantage of enhanced conversions.

About the author

Recently published

magnifiercrossmenu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram