Count per Day
“Count per Day” ist ein einfacher Besucherzähler.
Die Seitenaufrufe werden pro Artikel gespeichert. Dabei wird als “Reload-Sperre” nur ein Aufruf pro IP-Adresse und Tag berücksichtigt.
Beispiel: Wenn ein Leser 5 Artikel ansieht, sind alle “1 mal gelesen”, aber der Gesamtzähler erkennt, dass es nur ein Besucher war.
Die Aufrufe können pro Artikel angezeigt werden. Im Admin-Bereich gibt es weitere Statistiken.
Count per Day 2.9
Contributors: Tom BraiderDonate link: http://www.unicef.org
Tags: counter, count, posts, visits, reads, dashboard, widget
Requires at least: 2.7
Tested up to: 2.9.2
Stable tag: 2.9
Visit Counter, shows reads per page, visitors today, yesterday, last week, last months and other statistics.
Description
- count reads and visitors
- shows reads per page
- shows visitors today, yesterday, last week, last months and other statistics on dashboard
- you can show these statistics on frontend (e.g. on sidebar) too
- if you use Wordpress < 2.7 please use Count-per-Day v1.4
It counts 1 visit per IP per day. So any reload of the page don't increment the counter.
Languages: english, german, italian, portuguese, belorussian, uzbek
Installation
- unzip plugin directory into the
/wp-content/plugins/directory - activate the plugin through the
Pluginsmenu in WordPress
First activation will create the 2 tables wp _ cpd _ counter and wp _ cpd _ counter _ useronline.
Configuration
See the Options Page and check the default values. It's easy. :)
Install optional GeoIP database to show countries of your visitors.
If "Auto counter" is on reads on single-posts and pages will count without any changes on template.
For more informations see "Other Notes".
Frequently Asked Questions
Need Help? Find Bug?
read and write comments on plugin pageScreenshots
Arbitrary section
Functions
You can place these functions in your template.
Place functions within post-loop (e.g. in single.php)
Use
<?php if(method _ exists($count _ per _ day, "show")) $count _ per _ day->show(); ?> to check if plugin is activated. Without spaces " " near _ .show( $before, $after, $show, $count )- $before = text before number e.g.
<p>(standard "") - $after = text after number e.g.
reads</p>(standard " reads") - $show = true/false, "echo" complete string or "return" number only (standard true)
- $count = true/false, false will not count the reads (standard true)
count()- only count reads, without any output
- cpdShow call it
getFirstCount()- shows date of first count
getUserPerDay( $days )- shows average number of visitors per day of the last $days days
- default on dashboard (see it with mouse over number) = "Latest Counts
- Days" in options
getReadsAll()- shows number of total reads
getReadsToday()- shows number of reads today
getReadsYesterday()- shows number of reads yesterday
getUserAll()- shows number of total visitors
getUserOnline()- shows number of visitors just online
getUserToday()- shows number of visitors today
getUserYesterday()- shows number of visitors yesterday
getUserLastWeek()- shows number of visitors last week (7 days)
getUserPerMonth()- lists number of visitors per month
getUserPerPost( $limit = 0 )- lists $limit number of posts, -1: all, 0: get option from DB, x: number
getMostVisitedPosts( $days, $limits )- shows a list with the most visited posts in the last days
- $days = days to calc (last days), 0: get option from DB
- $limit = count of posts (last posts), 0: get option from DB
getClients()- shows visits per client/browser in percent
- clients are hardcoded in function but easy to change ;)
GeoIP
- With the GeoIP addon you can associate your visitors to an country using the ip adress.
- In the database a new column
countrywill be insert on plugin activation. - On options page you can update you current visits. This take a while!
Click the update button to check the rest.
- If the rest remains greater than 0 the IP adress is not in GeoIP database (accuracy 99.5%).
- You can update the GeoIP database from time to time to get new IP data.
- If the automaticaly update don't work download GeoIP.dat.gz and extract it to the "geoip" directory.
- More information about GeoIP on http://www.maxmind.com/app/geoip_country
Changelog
2.9
- New: little note system to mark special days
- New: functions to get reads/page views total, today and yesterday
- Language update: Italian thanks to Gianni Diurno http://gidibao.net/index.php/portfolio
- Language update: Portuguese (Brazil) thanks to Lucato http://www.ilucato.com.br
- Language update: Swedish thanks to Magnus Suther http://www.magnussuther.se
- Language update: Dansk thanks to Jonas Thomsen http://jonasthomsen.com
- Language update: German
2.8
- New: set user level until CpD will count loged users
- New: link to plugin page on Count per Day dashboard
- New: click on a bar in the charts reload the page with given date for
Visitors per daymetabox - New language: Swedish, thanks to Magnus Suther http://www.magnussuther.se
- New language: Dansk, thanks to GeorgeWP http://wordpress.blogos.dk
2.7
- Bugfix: date/timezone problem
- New: change start date and start count on option page
- New: "edit post" links on lists
- New: new list shows visitors per post on user defined date
- New: link to plugin page
2.6
- languages files now compatible with Wordpress 2.9
- New: improved CSS support for RTL blogs (e.g. arabic)
2.5
- BACKUP YOUR COUNTER DATABASE BEFORE UPDATE!
- Change: some big changes on database and functions to speed up mysql queries. This will take a while on activation!
- New: "Mass Bot Detector" shows and deletes clients that view more than x pages per day
- New: see count and time of queries if CPD_DEBUG true (on top of counter.php)
- Bugfix: cleanDB by IP now works
- Language update: Portuguese (Brazil), thanks to Beto Ribeiro http://www.sevenarts.com.br
2.4.2
- Bugfix: mysql systax error
- Bugfix: no country data was stored (GeoIP), use "Update old counter data" on options page
2.4
- Bugfix: works with PHP 4.x again (error line 169)
- Change: some functions now faster
- New: GeoIP included. You have to load GeoIP.dat file on option page before you can use it.
- Language updates: Italian (Gianni Diurno) and German
2.3.1
- Bugfix: counter do not work without GeoIP Addon (nonexisting row
countryin table)
2.3
- New: chart "visitors per day"
- New: counts index pages: homepage, categories, tags (if autocount is on)
- New: visits per client/browser in percent
- New: added some parameters to functions to overwrite default values
- New language: Usbek, thanks to Alisher
2.2
- Change: USER_AGENT must have > 20 chars, otherwise we call it "bot"
- New: optional GeoIP addon to show page views per country
- see Section "GeoIP addon"
2.1
- New: custom names on widget
- New: function "first count" on widget
- little changes on german translation
2.0
- New: sidebar widget
- New: reset button to set all counter to 0
- New: custom number of "reads per post" on dashboard page
- New: little chart of "reads per day" on dashboard page
- New: reads in post and page lists (optional)
- New: most visited posts in last days on dashboard page
- New: recognize bots by IP address
- New: movable metaboxes on dashboard page
- New: clean function now deletes counter of deleted pages too
- Bugfix: updates online counter on every load
- Bugfix: now empty user agents/clients will not be count
- change options to array
- create class, update/clean up/rename functions
1.5.1
- New language: Belorussian, thanks to Marcis Gasuns http://www.fatcow.com
1.5
- New: Dashboard Widget
- WP 2.7 optimized, for WP<2.7 please use CPD 1.4
1.4
- New: uninstall function of WP 2.7 implemented
- litle changes on layout to be suitable for WP 2.7
1.3
- New: you can delete old data if you add a new bot string
- Bugfix: Bot check was case-sensitive
- New language: Portuguese, thanks to Filipe
1.2.3
- Bugfix: autocount endless looping
1.2.2
- New language: Italian, thanks to Gianni Diurno http://gidibao.net/index.php/portfolio/
1.2.1
- Bugfix: Error 404 "Page not found" with "auto count"
1.2
- Bugfix: tables in DB were not be created every time (seen on mysql < 5)
- New: "auto count" can count visits without changes on template
1.1
- Languages: english, german
- HTTP _ USER _ AGENT will be saved, identification of new search bots
- Stylesheet in file counter.css
1.0
- first release
created by Readme Parser



![de [de]](http://www.tomsdimension.de/wp/wp-content/plugins/translate-with-google/img/de.png)
![en [en]](http://www.tomsdimension.de/wp/wp-content/plugins/translate-with-google/img/en.png)
![fr [fr]](http://www.tomsdimension.de/wp/wp-content/plugins/translate-with-google/img/fr.png)
![es [es]](http://www.tomsdimension.de/wp/wp-content/plugins/translate-with-google/img/es.png)
![it [it]](http://www.tomsdimension.de/wp/wp-content/plugins/translate-with-google/img/it.png)
![pt [pt]](http://www.tomsdimension.de/wp/wp-content/plugins/translate-with-google/img/pt.png)
![ru [ru]](http://www.tomsdimension.de/wp/wp-content/plugins/translate-with-google/img/ru.png)
![ko [ko]](http://www.tomsdimension.de/wp/wp-content/plugins/translate-with-google/img/ko.png)
RSS Artikel

Noch was (sorry, wenn ich Dir jetzt die Kommentarseite ‘vollmülle’): Es gibt bei der Auswertung der GeoIP den Fall, dass kein Land zugeordnet werden kann. Daher erscheint bei mir in der Auswertung eine Zeile mit einem broken Link (Ich glaube er sucht in der Zielseite nach einem File ‘…/.gif’ anstelle von z.B. …/DE.gif). Könntest Du nicht für so einen Fall ein Standard-Icon einbauen (z.B. Flagge mit Fragezeichen)?
OK, das ist natürlich ein Fehler, der ausgemerzt gehört. Meine Besucher kommen alle aus bekannten Ländern, da fiel mir das noch nicht auf.
Hi Tom,
gibt es eigentlich die Möglichkeit die Sortierung im Post-Loop nach der Anzahl der Counts durchzuführen?
Meinst du im Frontend, die Posts, die nach Datum sortiert sind?
Wozu könnte man das brauchen?
Du kannst dir ja eigene Querys für den Post-loop basteln und dort dann eben die Counter-Daten mit einfließen lassen. Aber ich denke, das wird sich je nach Anzahl der Besucher stark auf die Performance auswirken.
Ich habe mir eine tabellarische Übersicht gebastelt, wo ich z.B. auch nach den Ratings (GD Star Rating) sortiere (Siehe hier ). Da fände ich es schon auch charmant, nach der Anzahl der Reads suchen zu können…
Das mit den eigenen Queries habe ich glaube ich noch nicht probiert – bei GD Star Rating gab es da eben schon was…)
Kannst du dann nicht
$count_per_day->getUserPerPost(-1);benutzen. Wäre dann die “Besucher pro Artikel” Liste mit Titel und Anzahl, sortiert nach Anzahl. Anstatt -1 für alle, kannst du auch nur die 20 am meisten besuchten Seiten anzeigen lassen. Sollte auch im Frontend funktionieren. Ggf.global $count_per_day;davor setzen.Danke für das tolle Plugin! Ich hätte noch einen Verbesserungsvorschlag: Wäre es möglich, das Plugin auch so zu programmieren, dass es mit Hyper Cache oder Super Cache funktioniert?
Möglich vielleicht, aber Counter und gecachte Seiten mögen sich ja nicht unbedingt. Ich selbst benutze solche Plugins nicht, weiß daher auch nicht wie genau sie funktionieren. Vielleicht irgendwann mal.
Any idea why the Count per Day number on my blog is different from my Google Analytics numbers?
Use 10 counter and you will see 10 different numbers.
The counter have different filter. Count per Day counts only 1 visitor per page per day not every pageload.
In the plugin, the day starts in the afternoon, my time (I’m in California), I need to make it start at midnight my time, is there a way to do this? I can’t get an accurate daily read that way.
Oh, it is not fixed? I changed the time functions in version 2.7. OK, i will check it again.
I have a problem with browser statistics. I get 102% if summarize all percent. What is the problem?
(MSIE 46%, Firefox 34%, Chrome 4%, Opera 14%, AppleWebKit 4% = 102%)
It’s OK. All numbers are rounded. So e.g. 45.6 + 33.6 = 79.2 but shows 80 in summary.
Thanks, but if not rounded (decimal switch 0 to 2), and summarize, then get more than 100% too. I look into your code, but not found where is problem…
There are clients with two names in user-agent e.g.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195those count twice. AppleWebKit is “Safari” too, but i save only 100 chars (to save space). You can change the database to 255 chars and the code “AppleWebKit” to “Safari”.Ok, this works, and now get 100% if summarize all percent! Thanks for help!
Hi Tom
I am getting an error in post view count in the sidebar widget. For all posts it reads 117. However the Count per Day – Statistics page apears to be fine.
Thanks
Steve
Hi Tom
Sorry but i think it is another widget interfering with yours as your widget is fine when placed at the top of the sidebar, indicating a problem further down.
However this might be useful info for future bug reports of a similar nature.
If the fix i find is relevant to your widget i will post again.
Thanks for your time and Widget
Steve
OK, it’s strange. Perhaps it helps to activate debug mode (
define('CPD_DEBUG', true);at top of the code. It shows the sql querys at the bottom of your pages.Which plugins you use before CpD?
Its a piece of code i wrote for a widget.
Just me being untidy and it seems to be affecting the counter.
Could be a global var thats doing it, possibly $post.
CpD is a class, so all vars/functions are internal like $count_per_day->getUserAll();. Only $count_per_day is global.
Can you send me the code piece via contact form?
OK, try to rename your global var
$postto$mypostor whatelse. Perhaps you overwrite the default var and CpD cannot find the ID.Hello
I’ve just updated to CountPerDay 2.7, but now I see that I lost some previous data (today’s visitors, yesterday’s, last week’s, visitors per day) and the counter date is resetted. Is this normal?
Thanks
Solved by downgrading to CountPerDay 2.4 (not linked anymore on Wordpress plugins page, but yet present: http://downloads.wordpress.org/plugin/count-per-day.2.4.zip)
The strange thing is that versions 2.7, 2.6 and 2.5 doesn’t work well on my blog. Thanks
From 2.4 to 2.5 i made some big changes on the database, see readme above. To update, you have to deactivate the plugin, install new files and activate it. On activation the changes will take a while.
Otherwise uninstall (bottom on optionpage) your version to clear the database and install 2.7. Here you can set startdate an startcounter (summary) on optionpage.
PS: Older plugin versions you will find under the right link “Other Versions >” on the wordpress plugin page.
Can I send you a screen capture of a massive peak in traffic today which seems anomalous? I mean I am showing over 5000 visits where I am averaging around 700 per day. Does not coincide with Google Analytics at all.
See your database …cpd_counter to check the clients. I think you will find some spam/bots.
Add the strings to the blacklist and clean the database on options page to delete this entries. It’s my way in this case.
hello! i have just upgraded to Version 2.8 but there is a problem….it is showing ‘10———’ above my website’s header (http://zjtechlive.com)…please help me with this as soon as possible ..thanks
Sorry, this was a little mistake. Download the “new” Version 2.8. Or delete the line (near 200) with the code in
counter.php.Sorry Tom but i was not able to do it…can you please tell me exactly what i have to delete from counter.php….thnx
Delete line near 202:
echo intval($userdata->user_level).'---------';See trac.
Success…….great plugin by the way…thnx