Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics ecommerce incorrect total #1718

ablears opened this Issue Dec 21, 2014 · 2 comments


None yet
2 participants
Copy link

ablears commented Dec 21, 2014

Let's say I order two quantities of a product at $0.01 each for a total of $0.02.

The Google Analytics ecommerce tracking will send an incorrect total. Here's what it sends:

ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
            'id': '791',                                               // Transaction ID. Required.
            'affiliation': 'singapore-barcodes-(barcodes-limited)',  // Affiliation or store name.
            'revenue': '0.01',             // Grand Total.
            'shipping': '0.00',             // Shipping.
            'tax': '0.00'                        // Tax.
ga('ecommerce:addItem', {'id': '791','name': 'Test','sku': '','category': 'Barcodes','price': '0.01','quantity': '2'});

It should set the revenue to 0.02. I think this is happening because $total_price is calculated by the following which loops through items to build the total price but does not check for item quantity:

foreach ( $cart_items as $item ) {
        $total_tax   += $item['tax_charged'];
        $total_price += $item['price'];

@JustinSainton JustinSainton self-assigned this Dec 22, 2014

@JustinSainton JustinSainton added this to the 4.0 milestone Dec 22, 2014


This comment has been minimized.

Copy link

JustinSainton commented Dec 22, 2014

thanks for the report, @ablears! Let me know if it's looking better for you as of 61b977f


This comment has been minimized.

Copy link

ablears commented Dec 22, 2014

Thanks, that's great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.