Sha256: b9e7b3032578b65558e2f69f6e6af99ed9c2458b56cadc48580f303f79cc370d
Contents?: true
Size: 1.27 KB
Versions: 37
Compression:
Stored size: 1.27 KB
Contents
//= require jquery //= require jquery_ujs //= require jquery.cookie //= require lodash //= require is //= require bootstrap //= require rails.validations //= require rails.validations.simple_form // //= require_tree ./init // //= require_self var is = require('is') var _ = require('lodash') track = function(event, attributes, fn){ console.log("Track: " + event + " " + JSON.stringify(attributes)) if (is.fn(attributes)) fn = attributes, attributes = null; if (is.undefined(attributes)) { attributes = {} } if ($.cookie('invisible') == "true") { if (!is.undefined(fn)) { fn() } return } if (typeof(analytics) == 'undefined') { return } attrs = _.extend({ iteration: '<%= MVP::Iteration.version %>' }, attributes) analytics.track(event, attrs, fn) } setupAutomaticTracing = function(){ _.each(arguments, function(e){ switch (e.toLowerCase()) { case 'buttons': $('.btn').on('click', function(){ window.track("Button Clicked", { name: $(this).text() || $(this).attr('value') }) }) break; case 'links': $('a:not(.btn)').on('click', function(){ window.track("Link Clicked", { name: ($(this).text() || $(this).attr('value')) }) }) break; } }) } window.track = track;
Version data entries
37 entries across 37 versions & 1 rubygems