How to remove / modify Google Analytics ecommerce transaction in one click

All of the following orders/transactions (along with their associated sales data) are recorded and reported by Google Analytics:

  • A cancelled order
  • An order which is declined or unfulfilled
  • A test order placed on your website by your web developer.

Now in order to maintain accuracy in your ecommerce reports, you would want to remove all the test/cancelled/unfilled orders from Google Analytics. You can do that by reversing ecommerce transactions.

I have explained, reversing an ecommerce transaction before, by:

  • creating a duplicate of the order confirmation page
  • making changes to the ecommerce tracking code and
  • then firing the ecommerce code.

But all of this requires the help of a web developer and is time-consuming.

Today I am going to show you, how to remove/modify any ecommerce transaction in your Google Analytics report, in just one click and that too, all by yourself, without taking the help of a web developer.

For this purpose, we are going to use Google Analytics measurement protocol hit builder.

But don’t let the measurement protocol scares you. It is easier than you think.

Follow the steps below:

Step-1: Make sure you have the ‘Edit’ permission at the GA account/property level.

sales performance

Step-2: Take a note of the transaction ID you want to remove. You can find transaction ID by navigating to Conversions > Ecommerce > ‘Sales Performance‘ in your GA view:

Say, for example, if you want to remove a test transaction, then navigate to the ‘Sales Performance’ report in your GA view and find the ID of the test transaction. Once you know the transaction ID, make a note of it.

You will need this ID later when using the measurement protocol hit builder.

Step-3: Navigate to https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#ecom

Step-4: Click on the link ‘View this hit in the Measurement Protocol Hit Builder‘ under the section ‘Transaction Hit’:

view this hit in the protocol builder

This action will automatically populate the ‘Hit Payload’ field with sample transaction hit data:

hit payload

Step-5: Scroll down to the section ‘Hit Parameter Details‘ and then change the value of all parameters except ‘v’ and ‘t’:

hit parameter details 2

v => Version. The value of this parameter is always 1.

t => transaction hit type. Example of other hit types: pageview, screenview, event, item etc.

tid => your property ID. Example: UA-12345-12

cid => Anonymous Client ID. Example: 555 or any alphanumeric number.

ti => your transaction ID. Example: 12345

ta => Transaction affiliation. Example: WesternWear

tr => Transaction revenue. Example: 50.00

ts => Transaction shipping. Example: 32.00

tt => Transaction tax. Example: 12.00

cu => your Currency code. Example: EUR, USD etc

Let us suppose you want to remove the following transaction:

remove transaction

The transaction ID is ‘592999‘. So ti592999

The Transaction affiliation is ‘Pre-Payment‘. So taPre-Payment

The sales amount associated with the transaction is $9,752.40. So tr = 9752.40

The shipping amount associated with the transaction is $20.51 . So ts = 20.51

The tax amount associated with the transaction is $1,557.11. So tt = 1,557.11

The currency associated with the transaction is US dollars. So cu = USD

Let us suppose Your tracking id is: UA-12345-21

Now in order to remove this test order from your ecommerce report, create following transaction hit with the hit builder (with negative amount for sales, shipping and taxes):

v= 1

t= transaction

tid = UA-12345-21

cid = 6ec419f1-32e0-4546-bb9e-4cb97c586512

ti = 592999

ta = Pre-Payment

tr = -9752.40

ts = -20.51

tt = -1557.11

cu = USD

Here is how this transaction hit will look like in the hit builder:

hit payload1
hit payload2

Note: You can use any string as client id (cid).

Step-6: Click on the ‘validate hit‘ button to validate your hit:

validate hit

Once you clicked on the ‘validate hit’ button, you must see the ‘hit is valid’ message:

hit is valid

Step-7: Click on the ‘Send hit to Google Analytics’ button, to send the transaction hit to GA.

Step-8: Wait for at least 10 to 15 minutes, before you proceed to check your ‘Sales Performance’ report in GA and search for your test transaction.

If the test transaction was placed on the very same day you removed it then you would no longer see any entry for your test transaction in the ‘sales performance’ report.

If however the test transaction was placed several days/weeks/months ago then you will see a new entry in your ‘sales performance’ report which contains the reversed transaction:

reverse transaction

So for example, Let’s say a test transaction was placed on June 30 and you removed it on Oct 26.

Now if you see the GA report for June 30, you will still see the entry for the test transaction. Similarly, if you see the GA report for Oct 26, you will see the new entry for the reversed transaction.

So it may look like nothing changed and you end up getting one more entry for the same transaction.

But if you see the GA report from June 30 to Oct 26, you will notice the total amount associated with the test transaction is $0.

So what you basically removed when a test transaction is days/weeks/months old is the total amount associated with the transaction.

Use the same method to remove any transaction from GA.

Now let us suppose, the transaction that you want to remove, does not have any shipping and tax amounts associated with it. In that case, do not pass shipping and tax amounts in your transaction hit.

v=1 // Version.
&tid=UA-12345-21 // Tracking ID
&cid=4552423 // Anonymous client ID

&t=transaction // Transaction hit type
&ti=TEST24425 // Transaction ID
&tr=-500  // negative transaction revenue
&cu=GBP // Currency code

If you want to modify the details associated with a transaction, say you want to add sales and tax amounts to a transaction, then just supply them via the transaction hit:

v=1 // Version.
&tid=UA-12345-21 // Tracking ID
&cid=4552423 // Anonymous client ID

&t=transaction // Transaction hit type
&ti=23455655 // Transaction ID
&ts=10.22 // Add transaction shipping
&tt=1.21 // Add transaction tax
&cu=GBP // Currency code

Here I have added shipping amount (£10.22) and tax amount (£1.21) to the transaction, whose ID is ‘23455655’

However use the measurement protocol hit builder tool with extreme caution, as you can very easily skew your ecommerce data, if you are not sure what you are playing with.

  1. Google Analytics Ecommerce Tracking Tutorial
  2. Enhanced Ecommerce Tracking in Google Analytics – Tutorial
  3. Set up Enhanced Ecommerce Tracking in Google Analytics
  4. Using Enhanced Ecommerce segments for Remarketing in Google Analytics
  5. Using Cohort Analysis & Enhanced Ecommerce to Understand User Behavior
  6. Duplicate Transactions (orders) in Google Analytics
  7. Enhanced Ecommerce Tracking via Google Tag Manager
  8. Ecommerce Tracking Google Tag Manager (GTM) – Tutorial
  9. Shopify Enhanced Ecommerce Tracking in Google Analytics – Tutorial
  10. GA4 (Google Analytics 4) Ecommerce Tracking via GTM – Tutorial
  11. Why Google Analytics and Shopping Cart Sales data don’t match and how to fix it
  12. Tracking Google Analytics Paypal Referral and other payment gateways
  13. Subscription & Recurring Revenue Analytics in Google Analytics
  14. Understanding Google Analytics Product Data Import
  15. Shopping Cart Analytics Tutorial
  16. Learn To Read E-Commerce Reports In Google Analytics
  17. Dealing with Google Analytics Refund – Reverse Transaction
  18. How to reverse transaction in Google Analytics for gtag.js and analytics.js
  19. How to Fix Missing Ecommerce Data in Google Analytics

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade