Skip to content

Commit

Permalink
adjustments to mixpanel tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
hayeah committed Nov 10, 2011
1 parent 3c1ddf5 commit 8671978
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
2 changes: 1 addition & 1 deletion _site/atom.xml
Expand Up @@ -4,7 +4,7 @@
<title>Metacircus</title>
<link href="http://www.metacircus.com/atom.xml" rel="self"/>
<link href="http://www.metacircus.com"/>
<updated>2011-11-09T23:46:59-08:00</updated>
<updated>2011-11-10T00:14:55-08:00</updated>
<id>http://www.metacircus.com/</id>
<author>
<name>Howard Yeh</name>
Expand Down
11 changes: 8 additions & 3 deletions _site/js/main.coffee
Expand Up @@ -4,12 +4,17 @@ $ ->


window.track = (name,properties,cb) ->
mpq.track(name,properties,cb)
mpq.track(name,tracking_context(properties),cb)

track_links = () ->
$("a").click ->
$("a").each ->
a = $(this)
track("link",text: a.text(),href: a.attr("href"),id: a.attr("id"))
mpq.track_links(a,"link",tracking_context({text: a.text(),href: a.attr("href"),id: a.attr("id")}))

tracking_context = (props={}) ->
ctx = {}
ctx.path = document.location.pathname
$.extend ctx, props

# http://blog.stevenlevithan.com/archives/parseuri?a=10&b=11
window.parseUri = (str) ->
Expand Down
19 changes: 14 additions & 5 deletions _site/js/main.js
@@ -1,23 +1,32 @@
(function() {
var track_links;
var track_links, tracking_context;
$(function() {
track("view");
return track_links();
});
window.track = function(name, properties, cb) {
return mpq.track(name, properties, cb);
return mpq.track(name, tracking_context(properties), cb);
};
track_links = function() {
return $("a").click(function() {
return $("a").each(function() {
var a;
a = $(this);
return track("link", {
return mpq.track_links(a, "link", tracking_context({
text: a.text(),
href: a.attr("href"),
id: a.attr("id")
});
}));
});
};
tracking_context = function(props) {
var ctx;
if (props == null) {
props = {};
}
ctx = {};
ctx.path = document.location.pathname;
return $.extend(ctx, props);
};
window.parseUri = function(str) {
var i, m, o, uri;
o = parseUri.options;
Expand Down
11 changes: 8 additions & 3 deletions js/main.coffee
Expand Up @@ -4,12 +4,17 @@ $ ->


window.track = (name,properties,cb) ->
mpq.track(name,properties,cb)
mpq.track(name,tracking_context(properties),cb)

track_links = () ->
$("a").click ->
$("a").each ->
a = $(this)
track("link",text: a.text(),href: a.attr("href"),id: a.attr("id"))
mpq.track_links(a,"link",tracking_context({text: a.text(),href: a.attr("href"),id: a.attr("id")}))

tracking_context = (props={}) ->
ctx = {}
ctx.path = document.location.pathname
$.extend ctx, props

# http://blog.stevenlevithan.com/archives/parseuri?a=10&b=11
window.parseUri = (str) ->
Expand Down
19 changes: 14 additions & 5 deletions js/main.js
@@ -1,23 +1,32 @@
(function() {
var track_links;
var track_links, tracking_context;
$(function() {
track("view");
return track_links();
});
window.track = function(name, properties, cb) {
return mpq.track(name, properties, cb);
return mpq.track(name, tracking_context(properties), cb);
};
track_links = function() {
return $("a").click(function() {
return $("a").each(function() {
var a;
a = $(this);
return track("link", {
return mpq.track_links(a, "link", tracking_context({
text: a.text(),
href: a.attr("href"),
id: a.attr("id")
});
}));
});
};
tracking_context = function(props) {
var ctx;
if (props == null) {
props = {};
}
ctx = {};
ctx.path = document.location.pathname;
return $.extend(ctx, props);
};
window.parseUri = function(str) {
var i, m, o, uri;
o = parseUri.options;
Expand Down

0 comments on commit 8671978

Please sign in to comment.