Skip to content

Instantly share code, notes, and snippets.

@RedWolves
Created November 8, 2010 17:06
Show Gist options
  • Save RedWolves/667949 to your computer and use it in GitHub Desktop.
Save RedWolves/667949 to your computer and use it in GitHub Desktop.
var link = {
href: "",
_url: function() {
var key = "/download.axd/";
return this.href.substr(key.length);
},
extension: function() {
return this._url().substr(33, 3);
},
filename: function() {
return this._url().substr(this._url().search("/?d=") + 3);
},
path: function() {
return this.filename() + "." + this.extension();
}
};
$("a[href*=/download.axd/]").bind("click", function(e) {
link.href = $(this).attr("href");
_gaq.push(['_trackPageview', '/downloads/' + link.path()]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment