Khanh Hoang - Kenn
Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.
Knowing what your customers are doing before spending money in your Drupal Commerce store can be valuable information for your business. It could help you create the shopping experience that meets the needs of your customers. With Google Analytics you can collect valuable visitor behavior information. Drupal Commerce is where the actual sale happens. In this tutorial I will learn you how to put those two together. It enables you to integrate Drupal Commerce order information with Google Analytics.
First enable ecommerce tracking in your site's Google Analytics Profile. Learn how to do that in this Google Analytics tutorial on enabling ecommerce tracking. And while you're at it, make sure it reflects the right currency amount in that profile.
Download and enable Google Analytics module. To allow Drupal Commerce order tracking you should at least enter the Google Analytics UA id at example.com/admin/config/system/googleanalytics. If you want to do more advanced things like for example 'user segmentation' or 'internal site search' tracking, have a look at this tutorial about configuring Google Analytics module.
Download and enable Commerce Google Analytics module. No configuration required. Yes, module maintainers rock. They are making this even cooler: Rules integration is currently in development.
Make sure your Drupal Commerce product titles and Stock Keeping Units make sense as they will be used in reporting. Note that Commerce product titles are a different thing than the titles of your product display nodes. If you're using Commerce Kickstart, have a look at this tutorial on how to change the product titles.
Always be testing: place a few orders in your store, and check if they show up in your Google Analytics profile. Make sure you set the Google Analytics date range to include today - by default it doesn't include today. And make sure the order amounts, product prices, tax amounts and shipping cost are correctly tracked.
When testing your ecommerce order analytics you don't want to actually pay for the order with money. Have a look at the tutorial about configuring a 'no payment' payment method with Payment module to be able to pay without really paying for it.
If you're interested in tracking eCommerce metrics regarding email campaigns, have a look at my tutorial about tracking MailChimp campaign Metrics with Drupal Commerce and Google Analytics.