Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 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 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...