module Analytical module Modules class KissMetrics include Analytical::Modules::Base def initialize(options={}) super @tracking_command_location = :body_prepend end def init_javascript(location) init_location(location) do js = <<-HTML HTML js end end def identify(id, *args) data = args.first || {} "_kmq.push([\"identify\", \"#{data[:email]}\"]);" end def event(name, *args) data = args.first || {} "_kmq.push([\"record\", \"#{name}\", #{data.to_json}]);" end def set(data) return '' if data.blank? "_kmq.push([\"set\", #{data.to_json}]);" end def alias_identity(old_identity, new_identity) "_kmq.push([\"alias\", \"#{old_identity}\", \"#{new_identity}\"]);" end end end end