[SOLVED] unwanted repeated Firing of datalayer.push in vue


This Content is from Stack Overflow. Question asked by Charles


  • Google Tag Manager, single container
  • GA4, web data stream
  • GA is connected to GTM with GA4 through GA4 Configuration Tag
  • GTM initialisation has been copy/pasted under and as per instructions in GTM
  • Created add_to_cart tag
  • Created dataLayer, trigger in various ways

My code is this in .vue file

addToCart() {
        var payload = {
                'id': this.id,
                'wine': this.wine,
                'url': this.url,
                'vintage': this.vintage,
                'volume': this.volume,
                'price': this.price,
                'quantity': this.quantity,
                'totalQuantity': this.quantity,
                'available': this.available,
                'labelurl': this.labelurl,
                'estate': this.estate,

        this.$store.dispatch( 'updateCartline', payload );

        window.dataLayer = window.dataLayer || [];
                    event: "add_to_cart",
                    currency: "EUR",
                    value: payload.quantity * payload.price,
                    items: [
                            item_id: payload.id,
                            item_name: payload.wine + " " + payload.vintage + " " + payload.volume,
                            price: payload.price,
                            quantity: payload.quantity

When checking network in developer mode it appears that every time addToCart is invoked, 20 dataLayer.push are fired! On GA-4, the event add_to_cart reports 20 event calls.

enter image description here

What happens?
How can I obtain a correct behaviour (single firing)


Decided to kill the current property, create a new GA4 property in Analytics and link it with a newly ceated GA4 configuration event in GTM.

It solved the issue

This Question was asked in StackOverflow by Charles and Answered by Charles It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?