AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
2.8K members online now
2.8K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply
Highlighted

Exclude Tax from Revenue in Ecommerce tracking

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Our site is on BigCommerce. Although this ecommerce.js tracking code was provided by BigCommerce, they haven't offered a way to solve our issue. The problem is that we do not want the "Revenue" value to include tax. For whatever reason, tax isn't being recorded separately.  How do we modify our ecommerce.js code to exclude tax from revenue?

<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-XXXXXXXX-X', 'XXXXX.com');
    ga('send', 'pageview', 'search_query');
    ga('require', 'ecommerce', 'ecommerce.js');

    function trackEcommerce() {
    this._addTrans = addTrans;
    this._addItem = addItems;
    this._trackTrans = trackTrans;
    }
    function addTrans(orderID,store,total,tax,shipping,city,state,country) {
    ga('ecommerce:addTransaction', {
        'id': orderID,
        'affiliation': store,
        'revenue': total,
        'tax': tax,
        'shipping': shipping,
        'city': city,
        'state': state,
        'country': country
    });
    }
    function addItems(orderID,sku,product,variation,price,qty) {
    ga('ecommerce:addItem', {
        'id': orderID,
        'sku': sku,
        'name': product,
        'category': variation,
        'price': price,
        'quantity': qty
    });
    }
    function trackTrans() {
        ga('ecommerce:send');
    }
    var pageTracker = new trackEcommerce();
</script>
1 Expert replyverified_user

Exclude Tax from Revenue in Ecommerce tracking

Top Contributor
# 2
Top Contributor

Hi,

 

Maybe try:

'revenue': total - tax,


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Exclude Tax from Revenue in Ecommerce tracking

Explorer ✭ ✭ ✭
# 3
Explorer ✭ ✭ ✭

Hi,

 

If it doesn't work, you can also create a calculated metric in Google Analytics to get what you want.