Sha256: a181514849126f5d93d5b48a6aad0c4ef8d503981afc9544080e125bb1cdc692

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

class GAEvents
	class Event
		attr_accessor :client, :category, :action, :label, :value

		def initialize(client, category, action, label = nil, value = nil)
			@client = client
			@category = category
			@action = action
			@label = label
			@value = value
		end

		def params(tid)
			params = {
			"v" => 1,
			"tid" => tid,
			"cid" => @client,
			"t" => "event",
			"ec" => @category,
			"ea" => @action,
			"el" => @label,
			"ev" => @value
			}
			params.reject! { |k,v| !v }
		end

		def payload(tid)
			URI.encode_www_form params(tid)
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gaevents-0.1.1 lib/gaevents/event.rb