This entry will describe the way I keep all nucleus statistics in the database. For this purpose I use a combination of a couple of plugins that are written by either MoraeS or Xiffy. Although the results I have are very personalised I think the core is usable for all nucleus powerd sites.


Possible endresult: Sitestatistics

let the counting start

First and furmost, it's important that the 4 plugins mentioned before are installed. Beware that np_referrer is a highly customized plugin. The version that is needed to see the difference between a hit made by a vsitor coming from a search engine and a visitor coming fom some other webpage is still in development. Currently i think that 98% of the referrers are split correctly, but some exotic search engines do show up as a regular webpage. It's a feature I can live with, and which i finetune on almost a daily basis, but the need to do so is luckily decreasing.

To use the referrer plugin, look at the Referrer wiki page. You need to call this from all SkinParts which you would like to track. I use it on the Index, archive, archivelist and detailed item. To keep track of users without showing a list you could call it by using <%Referrer(last,0)%>.

Secondly you need to add np_views to your detailed page. Just add <%Views%> to your detailed skin, and it will start counting.

The QueryLog and Mostviewed plugins will do their work without the need of a call on a skin page.

Getting the statistics out on a webpage

Now that you've added all the different counters, it's time to get the statistics out. For this purpose i've created an extra webpage that I've put under control of nucleus. There is a thread on the nucleus forum that describes how you can implement extra pages that can use most of nucleus engine. View forum thread For testing purposes you could use the members page. This will relief you creating this extra page and parser.

To get the results that are on my example page I use this code:

<%Referrer(stats)%> <!-- will show total hits over the last 30 days, and amount coming from searchengines ... -->
<%QueryLog(20)%> <!-- will show the last 20 searches performed with your local search box -->
<%Referrer(lastall,100,0)%> <!-- will show last 100 'real hits', searchengines excluded -->
<%Referrer(lastall,100,1)%> <!-- will show last 100 searchengine hits -->
(not used, but possible: <%Referrer(lastall,100,2)%> will show last 100 hits, searchengines and real hits combined)
<%Referrer(topall,100,0)%> <!-- will show the top 100 referring sites, search engines excluded -->
<%Referrer(topall,100,1)%> <!-- will show the top 100 queries used on searchengines linking to your site -->
(not used, but possible: <%Referrer(topall,100,2)%> will show top 100 hits, searchengines and real hits combined) 
<%MostViewed(100)%> <!-- will show the 100 most viewed items on your site -->
<%Referrer(pop,100,0)%> <!-- populiar items linked from outside, searchengines excluded -->
(not used, but possible: <%Referrer(pop,100,1)%> most visited items by visitors coming from searchengines) 
(not used, but possible: <%Referrer(pop,100,2)%> most visited items by visitors coming from searchengines and real hits combined) 

Of course, once you get this running, I can imagine you are going to hack this. Please do, this is what i came up with in the last couple of months when looking at my referrers, and interpretations. It is possible, that your site is visited by completly other searchengines i'm unaware of. But i hope this will get you started.

/appie [aka xiffy]

statistics.txt ยท Last modified: 2016/02/12 06:35 (external edit)