Module: AnalyticsAttribution

Included in:
AnalyticsInstrumentation
Defined in:
lib/analytics_instrumentation/analytics_attribution.rb

Instance Method Summary collapse

Instance Method Details

#add_attribution(props = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/analytics_instrumentation/analytics_attribution.rb', line 2

def add_attribution(props={})
  # Gather
  attribution_data = {
    first_external_referrer:  get_first_referrer,
    latest_external_referrer: get_latest_referrer,
  }

  attribution_data.merge! get_utm(:first)
  attribution_data.merge! get_utm(:latest)

  # Persist
  attribution_data.each do |k,v|
    set_cookie k, v
  end

  # Merge
  props.merge! attribution_data
end