Sunday, 28 July 2013
New Plugin for blogger 'Download Counter'
It is the first plugin of kind created for websites which share downloadable resources. The plugin will amazingly works with all major blogging platforms like wordpress and bloggerblogs. It can even be used in static Sites or any CMS you Firebase system that allows developers to create dynamic and data-driven tools without worrying about backend development. You do not need to worry about server code or managing databases, firebase does it all for free. All you need is to code some delicious scripts that does half the work. This plugin is a custom alternative to Dstats download tracking service. Lets add this amazing tool to your blogger blogs!!!
may be using. This tool will count and display download stats whenever a visitor downloads a resource form your site. The data is stored at your firebase free account. Luckily we are amongst very few who have started developing tools using the newly introduced
may be using. This tool will count and display download stats whenever a visitor downloads a resource form your site. The data is stored at your firebase free account. Luckily we are amongst very few who have started developing tools using the newly introduced
The following link will take you to our first plugin created with the Firebase.
1. Create your Firebase Account * :
To store your data for the downloads, you will first sign up for a free account at Firebase.
Fill up the easy steps sensibly and then once your account has been activated, you must create your first Firebase database as guided below in step#2.
2. Create Firebase Database
Previously you could only create 2 firebases but now you can create a total 5! So create one for your download stats data
- Towards the bottom right side of your account, you will find the following submit box.
2. Give your firebase a short name. In my case I named it mbtblogstats. This name will be used as your unique Identification.
3. Hit create and note down your firebase URL because we would need it later in this tutorial.
Installing Download Counter Plugin's:
The steps below are for blogspot blogs. Wordpress users may simply note down the method and apply accordingly on their WP powered blogs.
- Go To Blogger > Template
- Backup your template
- Click Edit HTML
- *Search for </b:skin>. Click the black arrow to expand the code.
5. Paste the following Styles just above </b:skin>
/*----- download counter by MBT-----*/.mbtloading {
background: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigVAwBMekw6iwIBUlwxFv8jDhtV20Chut96mf2cYJ23EZVQEYG2EgZJJJbNV1FG_6b0zTtsAV0Mut300UGOZcd7t4m1loP9w_HqIWhBG9X-AEOnnWK5TIKdtu62luOBdFd1ASywaDo0Rad/s320/mbtloading.gif') no-repeat left center;
width: 16px;
height: 16px;
}.blog-stats {
color: #289728;
font: bold italic 18px georgia, arial;
float: right;
}
You can easily change the color and size of the Numeric Text count by editing #289728
Tip: Use our color generator Tool to pick a color of your choice
6. Now search </body> and just above it paste the following script:
<!-- Download Counter by MBT starts-->
<script type='text/javascript'>
window.setTimeout(function() {
document.body.className = document.body.className.replace('loading', '');
}, 10);
</script>
<script src='https://cdn.firebase.com/v0/firebase.js' type='text/javascript'/>
<script>
$.each($('[data-download-count=true]'), function (i, e) {
var elem = $(e).parent().find('#download-count').addClass('mbtloading');
var id = $(e).closest('.post-body').siblings('a[name]').attr('name') + "-" + $(e).attr('id');
var downloadStats = new Firebase("https://mbtblogstats.firebaseio.com/downloads/id/" + id);
var data = {}, isnew = false;
downloadStats.once('value', function (snapshot) {
data = snapshot.val();
if (data == null) {
data = {};
data.value = 0;
data.url = window.location.href;
data.id = id;
isnew = true;
}
elem.removeClass('mbtloading').text(data.value);
});
$(e).click(function (e) {
data.value++;
if (isnew) downloadStats.set(data);
else downloadStats.child('value').set(data.value);
});
});
//<![CDATA[
$(document).ready(function () {
//checks if the number of posts on this page are more than one then return.
if($('.post-outer').length > 1)
return;
//selects the element to be made sticky.
var stickElement = $('.date-header'),
//selects the element which would trigger the sticky elem to go away
hideTrigger = $('#comments'),
//class name to be added (it should match the class in CSS)
fixed = "fixed",
top = stickElement.offset().top;
$(window).scroll(function (event) {
var y = $(this).scrollTop();
var maxY = hideTrigger.offset().top;
if (y >= top && y < maxY) {
stickElement.addClass(fixed);
} else {
stickElement.removeClass(fixed);
}
});
});
//]]>
</script><!-- Download Counter by MBT Ends-->
Replace mbtblogstats with your Firebase name that you created in step#2.
7. * Now search for <head> and paste the following JQuery library just below<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script>
You may not add the jquery code if you have already linked to Jquery library in your blog.
8. Save your blog and you are all done with coding!
Displaying Download stats in the Posts
Now whenever you wish to display download stats for a particular file. Simple link to your file using the code below:
<div style="width:120px;">
<a data-download-count="true" href="#">Download Now!</a>
<div class="blog-stats" id="download-count">
</div>
</div>
- Replace the # sign with your File link.
- You can write anything instead of Download Now! If your link is bigger in length then increase the width of the counter so that it shows the count in alignment.
Need any help feel free to contact us.. !
Post Your Comment !
- Post Your Comment and for notifications, Click on 'Subscribe by Email' link below the comment form
- All Comments are Moderated and Answered within 12 to 24 hours
- SPAM = Trash
Subscribe to:
Post Comments (Atom)
1 Responses to “New Plugin for blogger 'Download Counter'”
25 August 2019 at 00:46
I've followed the procedures exactly but the counter is not showing
Post a Comment