Class: GoogleAnalytics::Events::Ecommerce::AddTransaction

Inherits:
GoogleAnalytics::Event show all
Defined in:
lib/google-analytics/events/events.rb

Overview

JavaScript equivalent:

ga('ecommerce:addTransaction', { 'id': '1234', 'affiliation': 'Acme Clothing', 'revenue': '11.99', 'shipping': '5', 'tax': '1.29', 'currency': 'EUR' // local currency code. });

Instance Attribute Summary

Attributes inherited from GoogleAnalytics::Event

#action, #name, #params

Instance Method Summary collapse

Methods inherited from GoogleAnalytics::Event

#single_event?

Constructor Details

#initialize(order_id, store_name, total, tax, shipping, city = nil, state_or_province = nil, country = nil) ⇒ AddTransaction

Returns a new instance of AddTransaction.



179
180
181
182
183
184
185
186
187
188
189
# File 'lib/google-analytics/events/events.rb', line 179

def initialize(order_id, store_name, total, tax, shipping, city=nil, state_or_province=nil, country=nil)
  # city.to_s, state_or_province.to_s, country.to_s

  super('ecommerce:addTransaction', {
    :id => order_id.to_s,
    :affiliation => store_name.to_s,
    :revenue => total.to_s,
    :tax => tax.to_s,
    :shipping => shipping.to_s
  })
end