Remove e-commerce transactions from Google Analytics

Extended Google Analytics measuremet.

An e-commerce module enables tracking of business. Thanks to this you know which traffic source brings the best cusommers, which pages has the biggest impact to conversions or which products are "top sellers".

Data in e-commerce are not accurate. Some users has disabled javascript in their browsers, some leave a webpage before all scripts are executed and request to Google Analytics server is sent. E-commerce has one additional distortion - cancelled transactions.

When a custommer changes his mind and cancel his purchase, data are just sent to Google Analytis servers and it is impossible to remove it completly. Analyst see some sales in his GA reports, which were not accomplished.

How to remove an e-commerce transaction

The solution is simple - it is necessary to use a "negative transaction". It is a transaction with total amount, tax and shipping are negative values, count of all items is negative also. I. e. when a custommer purchase 1 T-shirt for 10 USD, you have to track a negative transaction with -1 T-shirt with amount of -10 USD. Google Analytics deducts this amounts and consequest sales and sold item count will correspond with reality. You must however keep in mind that the number of transactions is not number of deals, but it is higher.

How to do it

If you use a GA script, you can use identical notation for an any number of created trackers:

<script type="text/javascript">
_gas.create(['UA-XXXXX-X', 't1']);

    '1234', // order ID - required
    'Store name', // store / affiliate name
    '-28.28', // price without TAXes and shipping - required
    '-1.29', // TAX
    '-15.00', // shipping
    'Carlisle', // city
    'Cumbria', // state
    'UK' // country

    '1234', // order ID - for association with order - required
    'DD44', // SKU/code - required
    'Teddy bear', // product name
    'Pink', // category / variant
    '28.28', // unit price - required
    '-1' // amount - required


Example for using plain GA tracking code is in Google documentation.