
(function(window) {
	"use strict";

	var Fn      = window.Fn;
	var dom     = window.dom;
	var Sparky  = window.Sparky;
	var rspaces = Fn.rspaces;

	function analyse(category, action, label, value) {
		window.ga && window.ga('send', 'event', category, action, label, value);
	}

	function analyseTime(category, action, label, time) {
		// Time should be an integer, in milliseconds
		time = Math.round(time || window.performance.now());
		window.ga && window.ga('send', 'timing', category, action, time, label);
	}

	Sparky.fn['analyse-on-click'] = function stickToTop(node, scopes) {
		node.addEventListener('click', function(e) {
			var node     = dom.closest('[data-analyse]', e.target);

			if (!node) {
				console.warn('Sparky: data-fn="analyse-on-click" requires data-analyse="category action label"');
				return;
			}

			var property = dom.attribute('data-analyse', node);
			var labels   = property.split(rspaces);

			analyse.apply(null, labels);
		});
	};

	Sparky.fn['analyse-on-change'] = function stickToTop(node, scopes) {
		node.addEventListener('change', function(e) {
			var node     = e.target;
			var property = dom.attribute('data-analyse', node);

			if (!property) {
				console.warn('Sparky: data-fn="analyse-on-change" requires data-analyse="category action label"');
				return;
			}

			var labels   = property.split(rspaces);

			analyse.apply(null, labels);
		});
	};
})(this);

@@ -509,16 +509,90 @@
 l);%0A%09%7D%0A%0A
+%09function dashesToSpaces(string) %7B%0A%09%09return string.replace('-', ' ');%0A%09%7D%0A%0A
 %09Sparky.
@@ -644,32 +644,32 @@
 node, scopes) %7B%0A
-
 %09%09node.addEventL
@@ -983,32 +983,52 @@
 y.split(rspaces)
+.map(dashesToSpaces)
 ;%0A%0A%09%09%09analyse.ap
@@ -1396,24 +1396,24 @@
 turn;%0A%09%09%09%7D%0A%0A
-
 %09%09%09var label
@@ -1437,24 +1437,44 @@
 lit(rspaces)
+.map(dashesToSpaces)
 ;%0A%0A%09%09%09analys

Convert dashes to spaces in data-anayse