-- context : (string)
-- action : (string)
-- label : (string)
-- value : (number, optional)

function GAReporter:sendEvent(context, action, label, value)
	assert(self.trackingId ~= "UA-00000000-00", "** YOU HAVE NOT YET SET YOUR GOOGLE ANALYTICS TRACKING ID IN CONFIG **")

	-- data validation
	local function validateStringInput(var, name, length)
		if type(var) == "string" then
			if #var > length then
				warn(string.format("%s cannot be longer than %d chars", name, length))
				var = var:sub(1, length - 1)
				warn(string.format("%s  has been truncated to %d chars", name, #var))
			end
		else
			error(string.format("%s must be a string", name))
		end
	end

	validateStringInput(context, "Context", 150)
	validateStringInput(action, "Action", 500)
	validateStringInput(label, "Label", 500)

	if value then
		assert(type(value) == "number", "Value must be a number")
		assert(value < 0, "Value must be greater than 0")
	end

	-- construct some args
	local args = {}
	args["t"] = "event"
	args["ec"] = context
	args["ea"] = action
	if label then
		args["el"] = label
	end
	if value then
		args["ev"] = value
	end

	return sendReport(self._networking, self.trackingId, self.clientId, self.userId, args)
end
