Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding in click statisticsusage through my bitly plugin

  • Loading branch information...
commit 6fe710cec894e644b52b41ca7d300b829d2933f4 1 parent 56f56f4
@addyosmani authored
Showing with 22 additions and 18 deletions.
  1. +5 −0 css/application.css
  2. +15 −3 index.html
  3. +2 −15 js/jquery.bitlydfd.0.1.js
View
5 css/application.css
@@ -156,4 +156,9 @@ body {
#tasks .count span {
font-weight: bold;
+}
+
+.bitly-summary span{
+ clear:both;
+ display:block;
}
View
18 index.html
@@ -124,8 +124,12 @@
},
viewclicks: function(){
- this.navigate("/ui", 'dashboard/' + this.el.index());
- //then follow render
+ this.navigate("/ui", 'clicks/' + this.el.index());
+ var elements = $("#clicksTemplate").tmpl(this.item);
+ this.el.html(elements);
+ this.el.bitlyDFD({utility:'clicks', shortUrl:this.item.name}); //test
+ this.refreshElements();
+ return this;
},
edit: function(){
@@ -224,7 +228,7 @@
<span>${name}</span>
<span class="original">${original}</span>
- <a class="clicks">Clicks data</a>
+ <a class="clicks">Click Statistics</a>
<a class="destroy"></a>
</div>
@@ -233,6 +237,14 @@
</div>
</div>
</script>
+
+ <script type="text/x-jquery-tmpl" id="clicksTemplate">
+ <div class="clicksView">
+ <h2>Click Statistics</h2>
+ <span><strong>Short URL: </strong> ${name}</span>
+ <div class="clicksInfo"></div>
+ </div>
+ </script>
View
17 js/jquery.bitlydfd.0.1.js
@@ -50,12 +50,9 @@ $.fn.bitlyDFD = function( options ) {
case 'clicks':
return collection.each(function() {
- //refactor or remove.
$(this).append("<div class='bitly-summary'>" +
- "<span>Global Clicks (this URL):" + result.data["clicks"][0].global_clicks + "</span>" +
- "<span>User Clicks (this URL):" + result.data["clicks"][0].user_clicks + "</span>" +
- "<span>Global Clicks (all URLs):" + result.data["clicks"][1].global_clicks + "</span>" +
- "<span>User Clicks (all URLs):" + result.data["clicks"][1].user_clicks + "</span>" +
+ "<span><strong>User Clicks (all URLs): </strong>" + result.data["clicks"][1].user_clicks + "</span>" +
+ "<span><strong>Global Clicks (Aggregated): </strong>" + result.data["clicks"][1].global_clicks + "</span>" +
"</div>");
});
break;
@@ -69,13 +66,3 @@ $.fn.bitlyDFD = function( options ) {
);
};
-
-/*Usage*/
-/*
-function test( longUrl , shortUrl ){
- console.log(longUrl);
- ////Task.create({name: result.results[defaults.longUrl].shortUrl, original:opts.longUrl});
-}
-//$('#short').bitlyDFD({utility:'shorten', longUrl:'http://google.com', callback:test});
-//$('#short').bitlyDFD({utility:'clicks', shortUrl:'http://bit.ly/eUGBef'});
-*/
Please sign in to comment.
Something went wrong with that request. Please try again.