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

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, completing a purchase, adding a product to the cart, or starting a checkout. Event measurement is interesting not only for web shops, but also for business websites. For example: measuring completed 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 are going to track events server side.

We assume you have already created a Google Tag Manager account. If you are looking for a description for creating a Google Tag Manager account, check out this article.

We show 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
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
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 e-commerce events, you need a GA4 datalayer. You can install these manually using the official GA4 documentation, or you can use a plugin or extension. For example:

For the business events, you don’t need a special datalayer, using the data automatically available in Google Tag Manager. In the remainder of this blog, we will look specifically at measuring e-commerce events. Want to learn 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 at ‘Trigger Configurations’ and choose ‘Custom event’ as the trigger type (under other).

type-trigger-choose-google-tag-manager Google Tag Manager

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: Events – Equals – [name of trigger]. Click “Save.


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 correctly configured the data layer, it sends all kinds of additional data about the products to GTM. You can use these for more insight. The following variables can be sent along with the datalayer:

Datalayer variableDescription
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 the Google Tag Manager preview mode, see how your DataLayer is structured. 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 “New” here. Select “Variable for data layer. Here you can extract the values of the variables from the datalayer so you can use them for your tracking. Name the variables in the Data Layer Variable Name field.


Naming Variables works as follows: you name the parameter you want to track by naming the route in the datalayer code from left to right, separated by a dot. What do we mean by that? Suppose we want to measure the paramater ‘value’ in this datalayer:

datalayer-example e-commerce

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 sample mode, you can discover how to name each parameter as a variable in GTM. In the example below, you can see that the price of a product as e-commerce comes in as price. Therefore, we should also call it as a variable ecommerce.price.

B2B event creation in Google Tag Manager

To track B2B events with Google Tag Manager, start by using built-in variables that Google Tag Manager (GTM) already provides. These variables automatically capture actions such as filling in form fields or clicking on a phone number. The advantage 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. This can range from clicking on a phone number to filling out a contact form.

Buillt in variables.

Then you set 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 completed form on your site.


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 Google Analytics: GA4 Event type. This is where 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.


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. Taking advantage of enhanced conversions requires specific events.

About the author

Ate Keurentjes

Ate Keurentjes

Server Side Tracking Specialist at TAGGRS

Ate Keurentjes is a Server Side Tracking specialist at TAGGRS. He has experience with various Google Tag Manager concepts. Keurentjes has been editing and writing about the latest developments and trends in data collection / Server side tracking since 2023.

Ready for the next level?

Start with Server Side Tracking and generate more revenue and conversions in a world without third-party cookies.