google-analyticsgoogle-tag-managermixpanelgoogle-datalayer

Will GTM get messed up if users push data to the data layer at the same time?


When using Google Tag Manager with a data layer variable ('payment_type'), if multiple users on different devices push data to the data layer simultaneously with different values, could this lead to receiving incorrect data in Google Tag Manager when a trigger fires a tag?

I am implementing Google Tag Manager in my app, where I use a data layer variable ('payment_type') to track payment methods. When a digital payment is made, I push data to the data layer using:

dataLayer.push({'event':'payment_made', 'payment_type':'digital'});

And for cash payments:

dataLayer.push({'event':'payment_made', 'payment_type':'cash'});

My concern is that when multiple users are using the app on different devices and pushing data to the data layer simultaneously with different values, could this result in receiving the wrong 'payment_type' variable value in Google Tag Manager when a trigger is fired and a tag is executed?

Example Scenario: User A makes a digital payment and pushes data to the data layer. Simultaneously, User B makes a cash payment and pushes data to the data layer. If a trigger is activated during this time, could the tag fire with the 'payment_type' value from the other user's transaction?

Does Google Tag Manager handle concurrent data layer pushes correctly so that each user's data is isolated and accurately captured when triggers fire tags?


Solution

  • Not really.

    Because every device is independent.

    User A : use cash payment. The browser only has dataLayer.push({'event':'payment_made', 'payment_type':'cash'});

    So GA4 got digital for User A.


    User B : use digital payment. The browser only has dataLayer.push({'event':'payment_made', 'payment_type':'digital'});

    So GA4 got digital for User B.


    So even there are 10000 users on your site at the same time.

    There is no error because each device has it's own runtime

    We only need to make sure we don't push the wrong dataLayer value.