Module: YagaHelper

Defined in:
app/helpers/yaga_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_custom_var(var) ⇒ Object



11
12
13
14
15
# File 'app/helpers/yaga_helper.rb', line 11

def format_custom_var(var)
  data = "#{var[:index]}, '#{var[:name]}', '#{var[:value]}'"
  data += ", #{var[:opt_scope]}" if var[:opt_scope]
  data
end

#format_event(event) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/yaga_helper.rb', line 3

def format_event(event)
  data = "'#{event[:category]}', '#{event[:action]}'"
  data += ", '#{event[:label]}'" if event[:label]
  data += ", #{event[:value]}" if event[:value]
  data += ", #{event[:non_interaction]}" if event[:non_interaction]
  data
end

#queue_custom_var(var) ⇒ Object



30
31
32
33
# File 'app/helpers/yaga_helper.rb', line 30

def queue_custom_var(var)
  session[:yaga_custom_vars] ||= Array.new
  session[:yaga_custom_vars] << var
end

#queue_event(event) ⇒ Object

protected



25
26
27
28
# File 'app/helpers/yaga_helper.rb', line 25

def queue_event(event)
  session[:yaga_events] ||= Array.new
  session[:yaga_events] << event
end

#yaga_snippetObject



17
18
19
20
21
# File 'app/helpers/yaga_helper.rb', line 17

def yaga_snippet
  if Yaga::CONFIG.try :[], 'google'
    render 'layouts/yaga/google'
  end
end