Usage
Events and where they fire
Section titled “Events and where they fire”| Event | When | Main parameters |
|---|---|---|
view_item_list |
Category pages, search results, brand (feature) pages, vendor stores (Multi-Vendor). Again after AJAX pagination, sorting, view switching and filters. | item_list_id (category_<id>, search_results, feature_<variant_id>, vendor_<id>), item_list_name, items with index |
select_item |
Click on a product link (or the quick view button) in a tracked list | item_list_id, item_list_name, items[1] |
view_item |
Product page and quick view. Carries the list of the preceding select_item. |
currency, value, items[1] |
add_to_cart |
Any cart increase: product page, lists, quick view, wishlist, quantity increase in the cart (AJAX or not) | currency, value, items (added quantity) |
remove_from_cart |
Removal from the cart or mini-cart, quantity decrease, clearing the cart | currency, value, items (removed quantity) |
view_cart |
Cart page | currency, value, coupon, items |
begin_checkout |
Checkout page (full page load) | currency, value, coupon, items |
add_shipping_info |
The shopper changes the shipping method on checkout. If the preselected method is kept, the event is sent when the order is placed. | shipping_tier, items |
add_payment_info |
The shopper changes the payment method. If the preselected method is kept, the event is sent when the order is placed. | payment_type, items |
purchase |
Order landing page, once per order. In Multi-Vendor, one per vendor order. | transaction_id, value, tax, shipping, currency, coupon, affiliation, items |
refund |
Server-side, when an order enters a refund status | transaction_id, value, currency |
search |
Search results page (first page) | search_term |
login |
Successful storefront login | method (email or the social provider) |
sign_up |
Customer registration | method |
add_to_wishlist |
Product added to the wishlist | currency, value, items |
Item parameters
Section titled “Item parameters”| Parameter | Source |
|---|---|
item_id |
Product code (SKU) or product ID (setting). For order lines, the code of the ordered option combination. |
item_name |
Product name in the configured language |
affiliation |
Multi-Vendor: vendor (company) name |
item_brand |
Value of the brand feature |
item_category … item_category5 |
Path of the product’s main category, from the root down |
item_variant |
Variation features (Product variations add-on) and selected options, e.g. Color: White, Size: Large |
price |
Unit price after catalog promotions, in the reporting currency |
discount |
Unit discount from catalog promotions |
quantity |
Quantity |
index, item_list_id, item_list_name |
List context (lists, select_item, view_item) |
Gifts added by promotions (free products) and child items of product bundles are not reported as cart changes.
AJAX add to cart
Section titled “AJAX add to cart”The add-on does not hook buttons. On the server it compares the cart at the start and at the end of each request and queues the matching events. They are delivered by:
- the AJAX response of the request itself (key
kv_ga4in the CS-Cart JSON response, sent once.ajaxdone). This covers add to cart without a page reload, the mini-cart and cart updates; - the next rendered page, if the request ended with a redirect.
So any button, block or add-on that changes the cart through CS-Cart is tracked. Logins, logouts and order placement also change the cart, but they are not reported as cart events.
Google Tag Manager setup
Section titled “Google Tag Manager setup”In GTM mode the add-on pushes, for every ecommerce event:
dataLayer.push({ ecommerce: null });dataLayer.push({ event: 'add_to_cart', ecommerce: { currency: 'USD', value: 130, items: [ { item_id: 'H0148VPS1T', item_name: '…', price: 130, quantity: 1 } ] }});Events without items are pushed flat: {event: 'search', search_term: 'sony'}, {event: 'login', method: 'email'}.
A minimal container:
- Google tag with your measurement ID, trigger Initialization – All Pages.
- A GA4 Event tag:
- Event name:
{{Event}}; - More settings → Ecommerce → Send Ecommerce data from the Data Layer;
- Trigger: Custom Event with the regex
view_item_list|select_item|view_item|add_to_cart|remove_from_cart|view_cart|begin_checkout|add_shipping_info|add_payment_info|purchase|add_to_wishlist.
- Event name:
- A GA4 Event tag for
search|login|sign_up, with the event parameterssearch_termandmethodread from Data Layer Variables.
The add-on writes the consent defaults with gtag('consent', 'default', …) before the container loads. Consent updates from the cookie dialog are pushed as gtag('consent', 'update', …), which GTM’s built-in consent checks understand.
Consent
Section titled “Consent”-
With the GDPR add-on (Settings → Cookie consent set to implicit or explicit): the dialog lists Google Analytics 4 and Google advertising. Accepting or declining them updates
analytics_storageand the three ad signals (ad_storage,ad_user_data,ad_personalization). The choice is also remembered in the cookiekv_ga4_consent, so the next page starts with the right state. -
With another consent banner: call the add-on’s API from the banner’s callbacks:
window.kvGa4.consent({ analytics: true, ads: false });or send your own
gtag('consent', 'update', …). In Basic mode the tag loads only afterkvGa4.consent({analytics: true}).
Purchases, de-duplication and the server-side fallback
Section titled “Purchases, de-duplication and the server-side fallback”- When an order is placed on the storefront, the add-on stores the GA client ID (from the
_gacookie), the GA session ID and the consent state. - On the order landing page (
checkout.complete), the purchase is printed once. A reload, the order link in an email or a second visit never sends it again. - When the Google tag has processed the purchase (gtag
event_callback/ GTMeventCallback), the page tells the server, which marks the order as confirmed. - Orders that are not confirmed after the configured delay are sent through the Measurement Protocol with the same
transaction_id, client ID and session ID, and with the original order time. This covers ad blockers, closed tabs and payment pages that never return to the store. Orders are not sent when:- analytics consent was denied;
- consent is unknown and the default for the customer’s billing country is denied;
- the order failed, was declined or was canceled;
- payment is still incomplete (status N: the server retries until the 72-hour window closes).
- Refunds use the same client ID when it is known.
Rarely, both the browser and the server report an order, for example when the confirmation request failed after the tag had fired. The server uses the visitor’s own client ID and the same transaction_id, so GA4’s de-duplication of purchases with the same transaction ID for the same user applies.
Multi-Vendor
Section titled “Multi-Vendor”- One
purchaseper vendor order (child order), withaffiliation= vendor name. The parent order is never sent. - Refunds are sent per vendor order.
- Item
affiliationis the vendor name on every event. - Vendor store pages (
companies.products) sendview_item_listwithitem_list_id = vendor_<company_id>.
CS-Cart (Ultimate) storefronts
Section titled “CS-Cart (Ultimate) storefronts”All settings can differ per storefront (another measurement ID, container or currency). Orders, refunds and the fallback use the settings of the storefront where the order was placed. The purchase affiliation is the storefront’s company name.