Jaime Montoya
Jaime Montoya

Reputation: 7711

What happens if I send the same "Transaction id" multiple times to track purchases in Google Analytics Ecommerce?

I am reading the documentation at https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce and they provide an example of code to measure transactions:

ga('ec:addProduct', {               // Provide product details in an productFieldObject.
  'id': 'P12345',                   // Product ID (string).
  'name': 'Android Warhol T-Shirt', // Product name (string).
  'category': 'Apparel',            // Product category (string).
  'brand': 'Google',                // Product brand (string).
  'variant': 'black',               // Product variant (string).
  'price': '29.20',                 // Product price (currency).
  'coupon': 'APPARELSALE',          // Product coupon (string).
  'quantity': 1                     // Product quantity (number).
});

ga('ec:setAction', 'purchase', {          // Transaction details are provided in an actionFieldObject.
  'id': 'T12345',                         // (Required) Transaction id (string).
  'affiliation': 'Google Store - Online', // Affiliation (string).
  'revenue': '37.39',                     // Revenue (currency).
  'tax': '2.85',                          // Tax (currency).
  'shipping': '5.34',                     // Shipping (currency).
  'coupon': 'SUMMER2013'                  // Transaction coupon (string).
});

In the ga('ec:setAction', 'purchase' section, the Transaction id (string) is required. For some reason in my code, something specific to my systems that I may have to fix later, but the point is that there is a possibility that in extraordinary situations, my code could send the same Transaction id (string) multiple times. In the code above, it means that for different transactions, I could be sending 'id': 'T12345' multiple times. What would happen in that case? How would Google Analytics report multiple transactions with redundant transaction IDs?

Upvotes: 1

Views: 2366

Answers (1)

Nico
Nico

Reputation: 316

GA doesn't require uniqueness on transaction ID, so you will see all of your transactions, even if you have multiple transactions with the same ID. You will see a value greater than one in the Quantity column of the Conversions > Ecommerce > Transaction report when there are duplicates.

If two transactions are reported in the same session for the same user with the same ID, the transaction should be* de-duplicated, though I haven't found this to be entirely reliable. It doesn't sound like this de-duplication applies to your situation, since presumably you are talking about different users and therefore different sessions.

*Sorry for the vagueness of "should be" - I've seen it happen, and it has been reported by other users, but I can't find it in GA documentation.

Upvotes: 2

Related Questions