jChartbeat
jChartbeat copied to clipboard
A simple and lightweight jQuery plugin for the Chartbeat API
jChartbeat
A simple and lightweight jQuery plugin for the Chartbeat API. The compiled version is less than 2k in size (500 bytes gzipped).
Usage
You can get set up with jChartbeat in 3 easy steps:
-
Source jQuery and jChartbeat
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="/path/to/jquery.jChartbeat.compiled.js"></script>
-
Initialize jChartbeat with your API Key and Domain
<script type="text/javascript"> $(document).ready(function() { $.jChartbeat({apikey: 'YOUR_API_KEY', host: 'YOUR_DOMAIN'}); }); </script>
-
Start calling the chartbeat API!
<script type="text/javascript"> $(document).ready(function() { $.jChartbeat({apikey: 'YOUR_API_KEY', host: 'YOUR_DOMAIN'}); // A call to chartbeat's Top Pages API. The response is returned in a callback. $.jChartbeat.toppages(function(response) { // Do stuff with the response object console.log(response); }); }); </script>