Fix #48 and add some convenience functionality

* Fixed issue #48 and added tests for exercising behaviors in different
scenarios.
* Encapsulated _ecommerceEnabled and _enhancedEcommerceEnabled to reduce
copy-paste code in several functions. Added tests to validate behaviors
in appropriate scenarios.
* Removed a duplicate test.
* Made some additional formatting fixes to make style consistent.