Documentation
Feedback
Guides
Storefront Development

Storefront Development
Store FrameworkConfiguring Google Tag ManagerSetting up Google Tag Manager events and triggers
Setting up Google Tag Manager

Explore how to track and analyze store data using Google Analytics 4.

After installing the VTEX IO Google Tag Manager app, configure the necessary variables, triggers, and tags to set it up in your store.

In this guide, you will learn how to track and analyze store data using Google Analytics 4 (GA4). The guide covers:

  • Configuring GA4 events by downloading and importing a container file; adding the necessary tags, triggers, and variables; and updating the Measurement ID field with your Google tag ID.
  • Testing the GA4 Configuration tag to ensure it fires correctly on every page and confirming that GA4 Event tags accurately track user actions, such as viewing a product or adding a product to the cart.
  • Using Google Analytics DebugView and Reports to check if events are being received and data is populating your reports.
  • Tracking key user actions — including product impressions, add-to-cart events, and completed orders — by leveraging Pixel Apps and GA4 events.

Before you begin

Get the VTEX IO Google Tag Manager app

Install and configure the VTEX IO Google Tag Manager app. For more information, see the guide Installing Google Tag Manager.

Create a Google Analytics 4 (GA4) Configuration tag

Create a Google Analytics 4 (GA4) Configuration tag using your Measumerent ID in Google Tag Manager (GTM). For more information, see the Google article Set up the Google Analytics 4 Configuration tag.

Instructions

Step 1 - Setting up GA4 events

After creating the GA4 Configuration tag, set up GA4 events as follows:

  1. Download the GTM container file to preload all necessary tags, triggers, and variables.

  2. Import the container file by following Google’s Import a container guide. This will add all the necessary tags, triggers, and variables to the workspace.

    {"base64":"  ","img":{"width":946,"height":1281,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":210180,"url":"https://vtexhelp.vtexassets.com/assets/docs/src/new-ga4-tags-variables___b2619df57689429d97a8abd56a5f7d83.png"}}

  3. In the GTM container, go to the GA4 Configuration tag, and edit the Measurement ID field with your Google tag ID (G- ID).

    To find your Google tag ID, check the Find your Google tag ID guide.

Step 2 - Testing tags in Google Tag Manager

To test if the GA4 Configuration tag is firing correctly on every page, use the Preview mode in GTM. Additionally, check if the GA4 Event tags are firing accurately for user actions, such as viewing a product or adding a product to the cart.

Step 3 - Testing events sent to Google Analytics 4

To check if the events are being received and the reports are populated with data, go to the Google Analytics Admin and use the DebugView to make sure the events are arriving and the Reports are getting the data.

{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAJUlEQVR4nAEaAOX/AC8vL6GhosDAwWZmZwAxMTKmpaje3t7W19eXjA2LN6VdtQAAAABJRU5ErkJggg==","img":{"src":"https://vtexhelp.vtexassets.com/assets/docs/src/gtm-debug-view___e2dc572dcc33e2e23e81749583226ec8.png","width":1488,"height":820,"type":"png"}}

To see the available events that GA4 can track, check the Overview of trackable events section.

Overview of trackable events

This section provides a list of events that GA4 can track and explains the view_promotion event, which is usually attached to the promotion banner carousel displayed by the Slider Layout block.

View promotion

The GA4 view_promotion event expects the product name or ID associated with it.

This event is commonly attached to the promotion banner carousel displayed by the Slider Layout block. For example, you can use Site Editor to configure the Product ID and Product Name. To access Site Editor, go to Storefront > Site Editor in the VTEX Admin.

{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAJUlEQVR4nAEaAOX/ANfV1Kyqo6Wjnff29wCZl5kXEQgfGA/Y2N3Oxg4Pt15I0QAAAABJRU5ErkJggg==","img":{"src":"https://vtexhelp.vtexassets.com/assets/docs/src/gtm-site-editor___bc52365aafad63deb5bfed1d74f307c0.png","width":819,"height":464,"type":"png"}}

Supported events

Check the available events that Pixel Apps can listen to, along with their corresponding names in Universal Analytics (UA) and Google Analytics 4 (GA4):

VTEXUAGA4
vtex:promoViewpromoViewview_promotion
vtex:promotionClickpromoClickselect_promotion
vtex:productImpressionimpressionsview_item_list
vtex:productClickclickselect_item
vtex:productViewdetailview_item
vtex:addToCartaddadd_to_cart
vtex:removeFromCartremoveremove_from_cart
vtex:viewCartNot applicableview_cart
vtex:beginCheckoutcheckoutbegin_checkout
vtex:addShippingInfoNot applicableadd_shipping_info
vtex:addPaymentInfoNot applicableadd_payment_info
vtex:orderPlacedpurchasepurchase
vtex:refundNot applicablerefund
vtex:searchNot applicablesearch
vtex:shareNot applicableshare
vtex:addToWishlistNot applicableadd_to_wishlist

Partially supported events

The following events are not fully supported yet. Although the GTM app will listen and format them into GA4, corresponding VTEX event triggers have not been implemented yet:

VTEXGA4
vtex:loginlogin
vtex:signUpsign_up
Contributors
1
Photo of the contributor
+ 1 contributors
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
+ 1 contributors
On this page