Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
570 views
in Technique[技术] by (71.8m points)

ga4 - Google Analytics 4 - Debug View - Monetization

i work on eCommerce website and handle google analytics events, i pushed event using JS into dataLayer array, add_to_cart fire correctly when product added to cart but the event fire with all items which already exist from previous event at dataLayer object with new item, i need to fire only with selected item

window.dataLayer = window.dataLayer || [];

    window.dataLayer.push({
        'event': 'add_to_cart',
        'ecommerce': {
            'items': [{
                'item_name': item_name, // Name or ID is required.
                'item_id': item_id,
                'price': price,
                'item_brand': item_brand,
                'item_category': item_category_1,
                'item_category_2': '',
                'item_category_3': '',
                'item_category_4': '',
                'item_variant': '',
                'item_list_name': 'Search List',
                'item_list_id': item_list_id,
                'index': 1,
                'quantity': quantity
            }]
        }
    });
question from:https://stackoverflow.com/questions/65915839/google-analytics-4-debug-view-monetization

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...