Closed wrobmat closed 6 months ago
No, it is not the expected behavior
So, what can i do? When i use another plugins i haven't this problems :/ Datalayer look like this (only first product was by added to cart): event: "add_to_cart", gtm: { uniqueEventId: 15, allowlist: undefined, blocklist: undefined, whitelist: undefined, blacklist: undefined, priorityId: 1, start: 1713946717929, scrollThreshold: 1, scrollUnits: "percent", scrollDirection: "vertical", triggers: "51062909_88", element: "HTMLButtonElement: html.js_active.vc_desktop.vc_transfo" + "rm.yes-js.js.no-touch.history.cssanimations.csstransfor" + "ms.csstransforms3d.csstransitions > body.product-templa" + "te-default.single.single-product.postid-10922.wp-embed-" + "responsive.theme-goya.woocommerce.woocommerce-page.wooc" + "ommerce-js.woo-variation-swatches.wvs-behavior-blur.wvs" + "-theme-goya-child.wvs-show-label.wvs-tooltip.blog-id-1." + "has-campaign-bar.has-top-bar.header-sticky.header-full-" + "width.floating-labels.login-single-column.et-login-popu" + "p.header-border-1.product-showcase-dark-text.sticky-hea" + "der-dark.page-header-regular.dark-title.wpb-js-composer" + ".js-comp-ver-7.5.vc_responsive.et-animation-ready.foxen" + "try-cms-custom > div.open#wrapper > div.page-wrapper-in" + "ner > div.site-content > div.et-product-detail.et-produ" + "ct-layout-regular.page-padding.et-cart-horizontal.produ" + "ct-details-accordion.et-variation-style-table.et-produc" + "t-gallery-carousel.thumbnails-vertical.thumbnails-hover" + "-swap.thumbnails-mobile-thumbs.has-breadcrumbs.product." + "type-product.post-10922.status-publish.first.instock.pr" + "oduct_cat-bizuteria_damska.product_cat-naszyjniki.produ" + "ct_cat-naszyjniki-z-kamieniami-naturalnymi.product_cat-" + "premium.product_tag-bestseller.product_tag-krysztal-gor" + "ski.product_tag-mama.product_tag-new.product_tag-new2.p" + "roduct_tag-prezentdlamamy.product_tag-walentynki.has-po" + "st-thumbnail.featured.taxable.shipping-taxable.purchasa" + "ble.product-type-simple#product-10922 > div.product-sho" + "wcase.showcase-regular.showcase-disabled.product-title-" + "right > div.container.showcase-inner > div.row.showcase" + "-row > div.col-12.col-lg-5.product-information > div.su" + "mmary.entry-summary > div.et-pro-summary-content > form" + ".cart > div.et-wishlist-div-open > button.single_add_to" + "_cart_button.button.alt", elementClasses: "single_add_to_cart_button button alt", elementId: "", elementTarget: "", elementUrl: "" }, ads_data_redaction: false, tagTypeBlacklist: undefined, url_passthrough: false, developer_id: {dY2Q2ZW: true}, ecommerce: { currency: "PLN", value: 159.9, items: [ { item_id: 10922, item_name: "FOREVER LOVE Naszyjnik pozłacany - kryształ górski", sku: "P073N/D", price: "159.90", stocklevel: 3, stockstatus: "instock", google_business_vertical: "retail", item_category: "Naszyjniki damskie z kamieniami naturalnymi", id: 10922, item_list_name: "Related Products", index: 1, product_type: "simple", item_brand: "", quantity: "1" }, { item_id: 36393, item_name: "MOON MAGIC Naszyjnik pozłacany - topaz", sku: "P296N/D", price: "199.90", stocklevel: 2, stockstatus: "instock", google_business_vertical: "retail", item_category: "Naszyjniki damskie z kamieniami naturalnymi", id: 36393, item_list_name: "Related Products", index: 2, product_type: "simple", item_brand: "" }, { item_id: 36998, item_name: "AURA Pierścionek srebrny pozłacany - cytryn", sku: "SP022/D", price: "249.90", stocklevel: 0, stockstatus: "outofstock", google_business_vertical: "retail", item_category: "Pierścionki damskie złote", id: 36998, item_list_name: "Related Products", index: 3, product_type: "simple", item_brand: "" }, { item_id: 20730, item_name: "ROSE Naszyjnik srebrny pozłacany - róża", sku: "SN005/D", price: "119.90", stocklevel: 1, stockstatus: "instock", google_business_vertical: "retail", item_category: "Naszyjniki damskie złote", id: 20730, item_list_name: "Related Products", index: 4, product_type: "simple", item_brand: "" }, { item_id: 11462, item_name: "GLOSSY Naszyjnik pozłacany - kwarc różowy", sku: "P108N/D", price: "179.90", stocklevel: 1, stockstatus: "instock", google_business_vertical: "retail", item_category: "Naszyjniki damskie z kamieniami naturalnymi", id: 11462, item_list_name: "Related Products", index: 5, product_type: "simple", item_brand: "" }, { item_id: 28429, item_name: "INDIVIDUAL Naszyjnik pozłacany - kryształ górski", sku: "P197N/D", price: "179.90", stocklevel: -5, stockstatus: "onbackorder", google_business_vertical: "retail", item_category: "Naszyjniki damskie z kamieniami naturalnymi", id: 28429, item_list_name: "Related Products", index: 6, product_type: "simple", item_brand: "" }, { item_id: 13395, item_name: "HARMONY Naszyjnik pozłacany - kryształ górski", sku: "P181N/D", price: "179.90", stocklevel: 2, stockstatus: "instock", google_business_vertical: "retail", item_category: "Naszyjniki damskie z kamieniami naturalnymi", id: 13395, item_list_name: "Related Products", index: 7, product_type: "simple", item_brand: "" } ] } }
You seem to be listing the current state of the data layer from the GTM preview page. This will include all products reported previously during a view_item_list and/or view_item event. This is because GTM preview shows you content of the data layer by merging data from previous events as well.
However, the GA4 event tag using the ecommerce checkbox only reads the last pushed ecommerce data which does not trigger merging.
If you feel uncomfortable with the list in GTM preview, you can activate a feature in GTM4WP settings, under Integration->WooCommerce there is a checkbox which turns on clearing the ecommerce object before every event. But I would like to emphasize that this does not change the accuracy of data collection since GA4 event tags do not merge ecommerce data pushed on the page as a whole.
Thanks! It was helpful!
Hi, add to cart event include main and random products in items. Do you know why?