# Google Analytics 4 gtag documentation

URL: https://shoptet.dev/news/frontend/google-analytics-4-gtag-documentation

November 30, 2023 · 8 min read
Pavel Husa

## List of Events

List of events sent to Shoptet during the implementation of Google Analytics 4:
• page_view
• generate_lead
• login
• sign_up
• search
• view_item_list
• view_item
• add_to_cart
• remove_from_cart
• view_cart
• begin_checkout
• add_shipping_info
• add_payment_info
• checkout_progress
• purchase

## page_view Event

The event is triggered upon script loading. Along with the 'page_view' event, additional information about the loaded page is also sent.

| Parameter | Value | Notes 
| content_group | homepage/category/… | Refer to the content_group code list 
| groups/send_to | GA4 | This specifies the data to be sent and is a technical parameter at the gtag library level. 
| currency | CZK | Currency Enforcement. 
| page_language | cs | Language Regulation. 
| user_id | bf0019fe-03a3-11ee-af0f-d216876cc7a6 | User Identification. 
| traffic_type | internal | Differentiating Logged-In Administrators 

## Items Object

A unified 'items' object is used for events and is automatically processed within Google Analytics 4

| Parameter | Example | Description 
| item_id | 774323 | Item Id. 
| item_name | ABC book | Item Name. 
| item_brand | New publishing house | Brand. 
| item_category | The Toy Store | The category tree can have up to five levels, based on the product's primary classification. 
| item_category2 | Kids' books |  
| item_category3 | From 6 years old |  
| item_category4 | Illustrated |  
| item_category5 | Short |  
| item_list_id | Refer to Codelist | Product List ID. 
| item_list_name | Refer to Codelist | Name of the Product List. 
| item_variant | DS888980183~Variant: 6-12 m – pink/6-12 m | ID~Verbal Label Based on Item Variant. 
| price | 201.00 | Price Excluding VAT. 
| quantity | 1 | Product Quantity. 
| index | 0 | Product Order in Listing (Key for 'view_item_list' event; starts at 0 for the first product) 
| coupon | TESTCOUPON~Discount coupon No. TESTCOUPON – Discount 10% | For 'purchase' events, the same coupon is applied at both the transaction and product levels. 

## item_list_id, item_list_name Codelist

Codelist for parameters with standardized values.

| Category / Module | Item_list_name | Item_list_id 
| Top 10 products | top10 | top10 
| Top Sellers | category_best_sellers: /kitchen | Category ID 
| Regular Category | category: /kitchen/ | Category ID 
| Brand Listing | brand: XXX | Category ID 
| Search results | search: standardized expression | always 999999 
| Popup with products | related_popup: popup ID | popup ID 

## Content_group Codelist

The codelist corresponds to the values that are passed within the data layer in the `shoptet.page.Type` variable.

| Page Type | Content_group | Comment 
| Article detail. | article | Article detail. 
| List of products in category. | category | List of products in category. 
| Product detail. | productDetail | Product detail. 
| Homepage. | homepage | Homepage. 
| Thank you page. | thankYou | Thank you page. 
| Cart steps. | cart | Cart steps. 
| Blog categories. | section | Blog categories. 
| Cart step shipping and payment. | billingAndShipping | Cart step shipping and payment. 
| Cart step customer details. | customerDetails | Cart step customer details. 
| Thank you page (order confirmation). | thankYou | Thank you page (order confirmation). 

## view_item Event

It's triggered upon loading the product detail page, also known as the product card. If the product has multiple variants, an initial 'view_item' event is sent with an empty 'item_variant' field. Then, upon selecting a variant, another 'view_item' event is sent with the selected variant filled in.

| Parameter | Value | Notes 
| currency | CZK | Currency Enforcement. 
| value | 123 | Can be used for a conversion event. 
| items | Standardized Object | Uniform handling of products. In the case of the 'view_item' event, the number is 1. 

## view_cart Event

The event is triggered upon entering the `/kosik/` page. If a coupon has been entered from a previous cart visit, it will be displayed here.

| Parameter | Value | Notes 
| currency | CZK | Currency Enforcement. 
| value | 10.00 | Can be used for a conversion event. 
| items | Standardized object | Unified work with products. 
| coupon | 86330287~Discount coupon No. 86330287 – 10% Discount. Redeemed Coupon. This is included if the user returns to an already initiated checkout where the coupon is already active. |  

## begin_checkout Event

The event is triggered upon entering the `/order/step-1/` page. If a coupon has been entered from a previous cart visit, it will be displayed here.

| Parameter | Value | Notes 
| currency | CZK | Currency Enforcement. 
| value | 10.00 | Can be used for a conversion event. 
| items | Standardized object | Unified work with products. 
| coupon | 86330287~Discount coupon No. 86330287 – 10% Discount. Redeemed Coupon. This is included if the user returns to an already initiated checkout where the coupon is already active. |  

## add_shipping_info Event

It's sent during the second step of the cart process (on the /step-2/ page) when default values have already been selected. By examining individual events, you can evaluate the popularity of different shipping options and compare them to the actual shipping methods chosen for purchases (for example, many may initially select "Balíkovna," but most end up choosing „Zásilkovna").

| Parameter | Value | Notes 
| currency | CZK | Currency Enforcement. 
| value | 10.00 | Can be used for a conversion event. 
| items | Standardized object | Unified work with products. 
| coupon | 86330287~Discount coupon No. 86330287 – 10% Discount. Redeemed Coupon. |  
| shipping_tier | glsCz~GLS – CZ | Type of transport (id~name). 

## add_payment_info Event

It's sent during the second step of the cart process (on the /step-2/ page) when default values have already been selected. By examining individual events, you can evaluate the popularity of different payment methods and compare them to the actual payment methods chosen for purchases (for example, many may initially select "cash on delivery," but most end up paying via "ShoptetPay"

| Parameter | Value | Notes 
| currency | CZK | Currency Enforcement. 
| value | 10.00 | Can be used for a conversion event. 
| items | Standardized object | Unified work with products. 
| coupon | 86330287~Discount coupon No. 86330287 – 10% Discount. Redeemed Coupon. |  
| payment_type | cashOnDelivery~Cash on Delivery (GLS) | Payment type id~name 

## checkout_progress Event

Follows on from `add_shipping_info` and `add_payment_info` . It includes both the shipping and payment types simultaneously, so you can perform an analysis from a single variable within Google Analytics 4.

| Parameter | Value | Notes 
| currency | CZK | Currency Enforcement. 
| value | 10.00 | Can be used for a conversion event. 
| items | Standardized object | Unified work with products. 
| coupon | 86330287~Discount coupon No. 86330287 – 10% Discount. Redeemed Coupon. |  
| payment_type | cashOnDelivery~Cash on Delivery (GLS) | Payment type id~name 
| shipping_tier | glsCz~GLS – CZ | Type of transport (id~name). 

## view_item_list Event

It offers the capability to work with impression data, serving as a valuable resource for both product sorting and monitoring product rankings across various categories.

| Parameter | Value | Notes 
| currency | CZK | Currency Enforcement. 
| value | 10.00 | Can be used for a conversion event. 
| items | Standardized object | Unified work with products. 
| item_list_id | Refer to Codelist | Product List ID. 
| Item_list_name | Refer to Codelist | Name of the Product List. 

## generate_lead Event

No additional parameters. Newsletter subscriptions through native integration.

## login Event

When logging in, the 'login' event is triggered and the user is simultaneously identified via their user_id.

| Parameter | Value | Notes 
| method | google | Login method. 

## sign_up Event

Upon registration, the 'sign_up' event is triggered, and identification is carried out via the user_id at the same time.

| Parameter | Value | Notes 
| method | facebook | Login method. 

## search Event

When using the native search feature and opening it on a new page (not yet implemented for the autocomplete feature), a 'search' event is sent along with the standardized search term.

| Parameter | Value | Notes 
| search_term | shoes | Standardized search term (diacritics removed and letters converted to lowercase). 

## purchase Event

Occurs when an order is submitted.

| Parameter | Value | Notes 
| transaction_id | 2023000033 | Transaction ID the same as in administration. 
| currency | CZK | Enforced currency of the transaction. 
| value | 201.65 | Can be utilized for a conversion event. This refers to the purchase amount, excluding both tax and shipping fees. 
| tax | 42.35 | Tax value (encompasses both product and shipping taxes). This aligns with the details listed under the 'Total Tax Line' in the admin panel. 
| shipping | 8.26 | Cost of shipping, VAT excluded. Consistent with the admin panel under 'Shipping Excluding VAT. 
| payment_type | cash~cash | Payment type in the format ID~Translation in the specified language. 
| shipping_tier | personal-collection~personal collection | Shipping method in the format ID~Translation in the specified language. 
| items | Standardized object | Unified work with products. 
| coupon | 86330287~Discount coupon No. 86330287 – 10% Discount. Redeemed Coupon. |  
| transaction_type | B2B/B2C | Transaction Type. 

## view_promotion and select_promotion Event

Not currently implemented.

## consents default

| Parameter | Value | Notes 
| analytics_storage | denied/granted |  
| ad_storage | denied/granted |  
| ad_personalization | denied/granted |  
| ad_user_data | denied/granted |  
| wait_for_update | 500 | Shoptet default value for visits without consent 

## consents update

The update_consent event is triggered within the data layer, allowing for the subsequent firing of events for additional tags at the GTM level.

| Parameter | Value | Notes 
| analytics_storage | denied/granted |  
| ad_storage | denied/granted |  
| ad_personalization | denied/granted |  
| ad_user_data | denied/granted |  

## Server-Side Integration (Premium Feature)

For clients with a premium plan, we support data transfer to Server-Side Google Tag Manager (SS GTM). This feature provides enhanced data security and greater control over data processing.

We implement this configuration using the `server_container_url` parameter as shown below:

```json
gtag('config', 'TAG_ID', {
  'server_container_url': 'https://analytics.example.com',
});
```

**Tags:**
- [Frontend](/news/tags/frontend/)
