I am trying to implement a system on a webshop, that can collect to google analytics, weather or not a user is a new visitor, or a returning visitor - This is based upon weather or not the user gets created upon checkout or if the user is already logged in.
I've gotten the data to send to google analytics through a custom dimension, created in GTM.
However my problem lies in, that i can get the analytics page to display "New Visitor" when a user is initially created. But if the user goes ahead and makes a new order right after the first order, the previous data is overwritten, and both orders becomes "Returning Visitor" in google analytics.
How do i get each order to stay as it is in google analytics ?
Here is the code i've used to push my data.
var dataToPush = {
'event': 'transactionEvent',
'transactionId': '112256',
'transactionAffiliation': 'CompanyName',
'transactionTotal': 250.00;,
'transactionTax': 0,
'transactionShipping': 0,
'CustomReturningVisitor' : 'Old Visitor',
'transactionProducts': []
}
dataLayer.push(dataToPush);
