Module: GaCollect::Measure

Defined in:
lib/ga_collect/measure/item.rb,
lib/ga_collect/measure/event.rb,
lib/ga_collect/measure/social.rb,
lib/ga_collect/measure/timing.rb,
lib/ga_collect/measure/pageview.rb,
lib/ga_collect/measure/exception.rb,
lib/ga_collect/measure/screenview.rb,
lib/ga_collect/measure/transaction.rb

Class Method Summary collapse

Class Method Details

.event(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
# File 'lib/ga_collect/measure/event.rb', line 5

def self.event(options={})
  raise ArgumentError, 'category is required'  if options[:ec].nil? || options[:ec].empty?
  raise ArgumentError, 'action is required'    if options[:ea].nil? || options[:ea].empty?

  params = {ec: '', ea: '', el: '', ev: ''}.merge(options)

  GaCollect::HTTP.get(params)
end

.exception(options = {}) ⇒ Object



5
6
7
8
9
# File 'lib/ga_collect/measure/exception.rb', line 5

def self.exception(options={})
  params = {exd: '', exf: ''}.merge(options)

  GaCollect::HTTP.get(params)
end

.item(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
# File 'lib/ga_collect/measure/item.rb', line 5

def self.item(options={})
  raise ArgumentError, 'transaction_id is required'  if options[:ti].nil? || options[:ti].to_s.empty?

  params = {ti: '', in: '', ip: 0, iq: 1, ic: '', iv: '', cu: 'EUR'}.merge(options)

  GaCollect::HTTP.get(params)
end

.pageview(options = {}) ⇒ Object



5
6
7
8
9
# File 'lib/ga_collect/measure/pageview.rb', line 5

def self.pageview(options={})
  params = {dh: '', dp: '', dt: ''}.merge(options)

  GaCollect::HTTP.get(params)
end

.screenview(options = {}) ⇒ Object



5
6
7
8
9
# File 'lib/ga_collect/measure/screenview.rb', line 5

def self.screenview(options={})
  params = {an: '', av: '', aid: '', aiid: '', cd: ''}.merge(options)

  GaCollect::HTTP.get(params)
end

.social(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
# File 'lib/ga_collect/measure/social.rb', line 5

def self.social(options={})
  raise ArgumentError, 'social_action is required'  if options[:sa].nil? || options[:sa].empty?
  raise ArgumentError, 'social_network is required' if options[:sn].nil? || options[:sn].empty?
  raise ArgumentError, 'social_target is required'  if options[:st].nil? || options[:st].empty?

  params = {sa: '', sn: '', st: ''}.merge(options)

  GaCollect::HTTP.get(params)
end

.timing(options = {}) ⇒ Object



5
6
7
8
9
# File 'lib/ga_collect/measure/timing.rb', line 5

def self.timing(options={})
  params = {utc: '', utv: '', utt: 0, utl: '', dns: 0, pdt: 0, rrt: 0, tcp: 0, srt: 0}.merge(options)

  GaCollect::HTTP.get(params)
end

.transaction(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
# File 'lib/ga_collect/measure/transaction.rb', line 5

def self.transaction(options={})
  raise ArgumentError, 'transaction_id is required'  if options[:ti].nil? || options[:ti].to_s.empty?

  params = {ti: '', ta: '', tr: 0, ts: 0, tt: 0, cu: 'EUR'}.merge(options)

  GaCollect::HTTP.get(params)
end