Module: AnalyticsGoo
- Defined in:
- lib/analytics_goo/google_analytics_adapter.rb,
lib/analytics_goo.rb
Overview
utmipc
Product Code. This is the sku code for a given product.
utmipc=989898ajssi
utmipn
Product Name, which is a URL-encoded string. utmipn=tee%20shirt
utmipr
Unit Price. Set at the item level. Value is set to numbers only in U.S. currency format.
utmipr=17100.32
utmiqt
Quantity. utmiqt=4
utmiva
Variations on an item. For example: large, medium, small, pink, white, black, green. String is URL-encoded.
utmiva=red;
utmt
A special type variable applied to events, transactions, items and user-defined variables. utmt=Dog%20Owner
utmtci
Billing City utmtci=San%20Diego
utmtco
Billing Country utmtco=United%20Kingdom
utmtid
Order ID, URL-encoded string. utmtid=a2343898
utmtrg
Billing region, URL-encoded string. utmtrg=New%20Brunswick
utmtsp
Shipping cost. Values as for unit and price. utmtsp=23.95
utmtst
Affiliation. Typically used for brick and mortar applications in ecommerce. utmtst=google%20mtv%20store
utmtto
Total. Values as for unit and price. utmtto=334.56
utmttx
Tax. Values as for unit and price. utmttx=29.16
Defined Under Namespace
Modules: InstanceMethods Classes: AnalyticsAdapter, AnalyticsAdapterNotFound, GoogleAnalyticsAdapter
Class Method Summary collapse
-
.config(type, analytics = {}) ⇒ Object
Factory for returning the appropriate analytics object.
Class Method Details
.config(type, analytics = {}) ⇒ Object
Factory for returning the appropriate analytics object. The type
is a symbol that defines the type of analytics tracker you want to create. Currently, the only acceptable value is :google_analytics. The analytics
hash holds the required keys of analytics_id and the domain of the adapter that you are configuring. Setting the key rails_core_mixins
to true will mixin an accessor for this object into the core rails framework classes (active_record, action_controller and action_mailer). The default for this is false so that there are no rails dependencies on the gem. The key environment
by default is set to “production”. The rails mixin functionality checks this value against its RAILS_ENV then it calls out to the analytics only if the value is nil or matches.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/analytics_goo.rb', line 35 def self.config(type, analytics = {}) begin s = type.to_s + "_adapter" adapter = "AnalyticsGoo::" + s.camelize analytics[:environment] = "production" if analytics[:environment].nil? if analytics[:rails_core_mixins] == true analytics[:noop] = (RAILS_ENV != analytics[:environment]) tracker = adapter.constantize.new(analytics) for framework in ([ :active_record, :action_controller, :action_mailer ]) framework.to_s.camelize.constantize.const_get("Base").send :include, AnalyticsGoo::InstanceMethods end silence_warnings { Object.const_set "ANALYTICS_TRACKER", AnalyticsGoo::AnalyticsAdapter.new(tracker) } else tracker = adapter.constantize.new(analytics) end AnalyticsGoo::AnalyticsAdapter.new(tracker) rescue StandardError raise AnalyticsAdapterNotFound end end |