segmentio/analytics.js-integrations — pull request #427 by shawnfrench (2014-10-04 17:02:57+00:00)
Title: Added Enhanced Ecommerce support to GA integration

Implements [Google Analytics Enhanced Ecommerce](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce). Fixes https://github.com/segmentio/analytics.js-integrations/issues/344.
```
window.analytics.initialize({
"Google Analytics": {
"trackingId": "UA-123456",
"enhancedEcommerce": true
}
});
```

NOTE: Requires my update to segmentio/analytics-events in https://github.com/shawnfrench/analytics-events/tree/more_events

To test you can edit components.json:
```
- "segmentio/analytics.js-integration": "0.3.x",
+ "shawnfrench/analytics.js-integration": "0.3.4",
```

Then run tests with:
- `make test integration=google-analytics`

Requirements for full EE support
- [x] Initialize ec.js
- [x] Product list impressions and clicks (for example, measuring the impression of a product in a list of search results)
- [x] Internal promotion impressions and clicks (such as banners displayed to promote a sale on another section of a website)
- [x] Product detail views
- [x] Add/remove from cart
- [x] All checkout steps and checkout options where relevant
- [x] Transactions
- [x] Specifying local currencies
- [x] Coupon support
- [x] Refunds

Enhanced Ecommerce [action-types](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#action-types)
- [x] click	A click on a product or product link for one or more products.
- [x] detail	A view of product details.
- [x] add	Adding one or more products to a shopping cart.
- [x] remove	Remove one or more products from a shopping cart.
- [x] checkout	Initiating the checkout process for one or more products.
- [x] checkout_option	Sending the option value for a given checkout step.
- [x] purchase	The sale of one or more products.
- [x] refund	The refund of one or more products.
- [x] promo_click	A click on an internal promotion.

Analytics.js ecommerce [track events](https://segment.io/docs/tracking-api/ecommerce/):
- [x] 'Completed Order' With properties like id, sku, category, price, name…
- [x] 'Added Product' With properties like id, sku, category, price, name, quantity…
- [x] 'Removed Product' With properties like id, sku, category, price, name, quantity…
- [x] 'Viewed Product' With properties like id, sku, category, price, name…

TODO: Should we also implement EE on some of these?
- [ ] 'Viewed Product Category' With properties like category…
- [ ] 'Favorited Product'	With properties like id, sku, category, price, name…
- [ ] 'Liked Product'	With properties like id, sku, category, price, name…
- [ ] 'Shared Product'	With properties like id, sku, category, price, name, as well as the network they shared on, for example: Facebook, Twitter or Email.
- [ ] 'Wishlisted Product'	With properties like id, sku, category, price, name…
- [ ] 'Reviewed Product'	With properties like id, sku, category, price, name, and the product rating given.
- [ ] 'Filtered Products'	With properties like category, price, size…
- [ ] 'Sorted Products'	With properties like category, price, size…
- [ ] 'Searched Products'	With properties like query, results…
- [ ] 'Viewed Product Image'	With properties like id, sku, category, price, name…
- [ ] 'Viewed Product Reviews'	With properties like id, sku, category, price, name, and the averageRatings and reviewCount.
- [ ] 'Viewed Sale Page'	With properties like campaign and coupon. Using the page method.