Skip to content

Instantly share code, notes, and snippets.

@joemocha
Created December 6, 2010 03:20
Show Gist options
  • Save joemocha/729789 to your computer and use it in GitHub Desktop.
Save joemocha/729789 to your computer and use it in GitHub Desktop.
function(){
if (!FCG.track){
FCG.track = {
host: "http://localhost:6789",
events: ["load", "click", "submit", "unload"]
run: function(node, event, data){
$(node).on(event, function(){
/*
You might want to massage the data hash
i.e. in pseudo code
var new_data = data.inject({}) do |sum, (key, value)|
sum[key] = case value
when String
else
value
end
sum
end
*/
$(document).trigger("activity:fire", { activity: data });
});
}
};
}
return {
track: FCG.track.run
};
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment