Class: UniversalTrackManager::Visit

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/universal_track_manager/models/visit.rb

Instance Method Summary collapse

Instance Method Details

#matches_all_utms?(params) ⇒ Boolean

class_name: “UniveralTrackManager::Visit”,

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/universal_track_manager/models/visit.rb', line 9

def matches_all_utms?(params)
  if !campaign
    # this visit has no campaign, which means all UTMs = null
    # if any of the UTMs are present, return false (they don't match null)
    return ! UniversalTrackManager.campaign_column_symbols.any? do |key|
      params[key].present?
    end
  end

  # note params are allowed to be missing
  UniversalTrackManager.campaign_column_symbols.each do |c|
    if (campaign[c] && (campaign[c] != params[c])) || (!campaign[c] && params[c])
      return false
    end
  end
  return true
end

#nameObject



27
28
29
# File 'lib/universal_track_manager/models/visit.rb', line 27

def name
  "#{ip_v4_address} #{browser.name}"
end