I don't use codeIgniter but here's how you can do this in straight php.
Basically, you can either use sessions to record each visit to your site and record their page requests or you can simply record each hit on the page. The first option gives you more information (how many unique hits were made, how many hits are from returning visitors, etc.) but takes more programming to set up and requires user session management. So, for your purposes I'll explain option 2.
SQL:
Table 'pageViews'
Id - Integer, auto Increment, primary key
page - varchar(150)
datetime - datetime
On the page you're monitoring, you would add:
$query2 = "INSERT INTO `pageViews` (page, datetime) VALUES ('".$_SERVER["SCRIPT_NAME"]."', ".date("Y-M-d H:I:s").")";
$result2 = //insert DB connection etc. to apply update to DB
You can then fetch the rows from the db based on the page and the datetime stamp, count the results and display it using html5 canvas. Or, because each hit has a datetime, you can break it down further into hours of the day etc.
I hope this helps.
To modify this for simple daily counters, add an extra column called 'views' that is just an integer. Then on the page put a check to see if there is a row for the current page for today in the db. If so, then get the current views value and increment it and resale to the DB.
For the total views count I would probably create another table with the same columns but not with the date-time column. Then on your page, you increment the views value for the current page in the new table too.
This would be lightening fast. The trade-off is the loss of detail. So, here's the MySQL and PHP for this 3rd option:
MySQL:
Table 'dailyViews'
Id - Integer, auto Increment, primary key
views - integer
page - varchar(150)
datetime - datetime
Table 'totalViews'
Id - Integer, auto Increment, primary key
views - integer
page - varchar(150)
PHP:
// Search the DB for an entry today for this page in dailyViews
$query = "SELECT views FROM `dailyViews` WHERE `page`='".$_SERVER["SCRIPT_NAME"]."' AND `datetime`=".date("Y-M-d H:I:s")."";
$result = //insert your db connection etc to execute the query
if (mysqli_num_rows($result)==1) {
$resultArray = mysqli_fetch_array($result, MYSQLI_ASSOC);
$views = $resultArray['views']+1;
$query2 = "UPDATE `dailyViews` SET `views`=".$views." WHERE `page`='".$_SERVER["SCRIPT_NAME"]."' AND `datetime`=".date("Y-M-d H:I:s")."";
$result2 = //insert DB connection etc. to apply update to DB
} else if (mysqli_num_rows($result)<1) {
$query2 = "INSERT INTO `dailyViews` (views, page, datetime) VALUES (1, '".$_SERVER["SCRIPT_NAME"]."', ".date("Y-M-d H:I:s").")";
$result2 = //insert DB connection etc. to apply update to DB
} else {
// there is more than one entry for this page and date in the DB. An error has ccurred
}
// Then just get the total views for this page and increase it by 1.