Enhanced E-Commerce in Google Analytics Overview
By: Ziad Ismail
Tags: Google, Ecommerce, Google Analytics

Overview

The enhanced eCommerce plug-in for analytics.js enables the measurement of user interactions with products on eCommerce websites across the user’s shopping experience, including product impressions, product clicks, viewing product details, adding a product to a go-cart, initiating the checkout process, transactions, and refunds.

Migration and Compatibility with Ecommerce Plug-in (ecommerce.js)

Important: the improved Ecommerce plug-in mustn’t be used alongside the Ecommerce (ecommerce.js) plug-in for the identical property.

If you’ve already implemented Ecommerce measurement and need to start using Enhanced Ecommerce there are two main options:

Use a brand new property

You can add an extra tracker for a newly created property and tag/enable Enhanced Ecommerce for the new property. See Working with Multiple Tracking Objects for details on some way to send data to multiple properties from one page.

Migrate an existing property

To migrate from the eCommerce plug-in to the improved eCommerce plug-in, current analytics.js users should remove and replace references with enhanced eCommerce code.

If you’re currently using ga.js, you will first migrate to analytics.js before using the improved e-commerce plug-in.

Transaction and item data previously collected using the ecommerce.js plug-in won’t be sick with the migration and might remain available within the properties and profiles to which they were originally sent.

Installing the improved Ecommerce Plugin

Let’s not beat around the bush: this may be dangerous, quick, or simple. It requires an understanding of javascript and coding that not everyone possesses. Avoid the headaches and frustration which can inevitably include doing it yourself and consider outsourcing to an experienced web developer which can handle the tricky bits for you.

Alternatively, if you’re lucky, your eCommerce platform is additionally one with built-in integration, including:

Shopify and their paid Actionable Google Analytics app for $39/month.

WordPress with WooCommerce users can try the improved Ecommerce Google Analytics Plugin.

Magento and their Enhanced Ecommerce extension.

The Enhanced Ecommerce plugin mustn’t be used with the eCommerce plugin (which tracks transaction and item data). If you previously implemented the eCommerce plugin, you should either create and use a replacement property (and work with multiple trackers) or migrate your existing property from eCommerce to Enhanced Ecommerce (by removing and replacing references with the improved code).

If you decide on the DIY route, installing the plugin are often accomplished in three steps:

Ensure you’re using Universal Analytics, as ec.js will only work thereupon protocol. If you’re still using Classic Analytics, you’d prefer to update to Universal (you’ll see a “Universal Analytics Upgrade” link within the Property column on the Admin tab).

Install the suitable ec.js tracking code on every page of your website that you simply just want to trace.

Once everything’s in place, enable Enhanced Ecommerce Settings on Analytics under Admin > View > Ecommerce Settings.

And done (if only it were that easy). Unfortunately, it’s that second step that will cause you to tug your hair out.

To load the improved eCommerce plugin, use the command ga(‘require’, ‘ec’); after you create your tracker object and before you utilize any of the actual functionality in your Analytics tracking code.

Within your tracking code, the order is all-important:

ga(‘create’, ‘UA-XXXXXXXX-X,’ ‘auto’); command to make your tracking code must come first

ga(‘require’, ‘ec’); command for the improved eCommerce plugin must follow it

Specific plugin commands appear next (more on this below)

Finally, near the underside, you want a command to send the knowledge to Analytics like ga(‘send’, ‘pageview’);

You create the tracker code, load the ec.js plugin, execute the actual function(s), so send the information, in that — and only that — sequence. Otherwise, there’s not any joy.

The features of the improved eCommerce plugin are too extensive to seem in the slightest degree of them here. Instead, let’s take a look at a variety of the foremost effective functions to try and do out first.

Impressions

Information on products that are viewed, and mentioned as an impressionFieldObject.

Product

Data on the individual products viewed, added to cart, and so on. stated as a productFieldObject.

Promotion

Information about viewed promotions, and remarked as a promoFieldObject.

Action

Details about action related specifically to eCommerce and remarked as an actionFieldObject.

PAGE VIEW OR EVENT TAG

Whether you’d prefer to use a Page View or Event tag and also the way you set up your Custom Event triggers is completely up to you.

Personally, I always use Event tags. Why? Because if you utilize a Page View tag, you lack insight into what Enhanced Ecommerce events are collected in Google Analytics. This might make debugging a broken implementation difficult. By using events, I can always examine the best Events report back to determine all the improved Ecommerce hits sent to GA.

You can even add things like order ID because of the Event Label of these hits, so you will be ready to really start debugging if the event for the order was sent but no transaction was actually received within the Ecommerce reports.

If you’re doing use an occurrence tag, setting the nonInteraction field is, again, up to you. Personally, I set it to true when the event is shipped with the page load and false altogether other instances.

But you’re doing exactly what works best for you. Sometimes you’d possibly want to avoid events if you’re approaching the five hundred hits per session limit. Not an honest reason, but a reason nonetheless.

A WORD ON SCRAPING THE DOM

Scraping the DOM refers to the habit of accessing the dynamic HTML representation of the page (the Document Object Model) directly with JavaScript and populating the improved Ecommerce key-value pairs with values found on the page. On a receipt page, as an example, you often see the order ID, the entire value of the transaction, all products, shipping costs, then forth. So you will at the same time as well scrape these from the page rather than prying a sophisticated specification project together with your front-end developers.

function() ;

});

return,

products: products

}

}

};

}

It’s not pretty, and it comes with plenty of luggage and technical debt. For one, you’re introducing an infinite weak link in your tracking. If anything changes on the page, e.g. due to an A/B-test, it’s possible your scraper will break.

Furthermore, it’s fairly common to not include all details about products on the receipt page. Typically, just the name, ID, price, and tax of the road item is enough. This means you’ll miss all the other vital metadata like the product category, brand, variant, etc.

In other words, scraping could also be straightforward because of getting some data quickly, and for that, it’s a good tool. But used on its own to carry the data quality of your entire Enhanced Ecommerce process? Not most.