Class: Kameleoon::Targeting::ConversionCondition Private

Inherits:
VisitorScopeCondition show all
Defined in:
lib/kameleoon/targeting/conditions/conversion_condition.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: TargetingData

Constant Summary

Constants inherited from VisitorScopeCondition

VisitorScopeCondition::MAX_VISITOR_VISIT_COUNT, VisitorScopeCondition::MIN_VISITOR_VISIT_COUNT

Instance Attribute Summary

Attributes inherited from Condition

#id, #include, #type

Instance Method Summary collapse

Constructor Details

#initialize(json_condition) ⇒ ConversionCondition

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ConversionCondition.



9
10
11
12
# File 'lib/kameleoon/targeting/conditions/conversion_condition.rb', line 9

def initialize(json_condition)
  super(json_condition, VisitScope::VISITOR)
  @goal_id = json_condition['goalId']
end

Instance Method Details

#check(data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
18
19
# File 'lib/kameleoon/targeting/conditions/conversion_condition.rb', line 14

def check(data)
  return false unless data.is_a?(TargetingData)

  threshold = assignment_threshold(data.visitor_visits)
  targeted_conversion?(data.conversions, threshold)
end