lib/vanity/experiment/ab_test.rb in vanity-1.9.0 vs lib/vanity/experiment/ab_test.rb in vanity-1.9.1

- old
+ new

@@ -458,13 +458,14 @@ @metrics.each do |metric| metric.hook &method(:track!) end end - # Called when tracking associated metric. + # Called via a hook by the associated metric. def track!(metric_id, timestamp, count, *args) return unless active? identity = identity() rescue nil + identity ||= args.last[:identity] if args.last.is_a?(Hash) && args.last[:identity] if identity return if connection.ab_showing(@id, identity) index = alternative_for(identity) connection.ab_add_conversion @id, index, identity, count check_completion!