MISSING: Tutorial - Displaying (Visitor-) Counter and (Pageviews-) Counter in simple text form!

Hello all together!

I just have updated my old Piwik 1.x to 2.0.3 and love it, but since i know Piwik there is the (probably) requested and needed Tutorial (How To) missing at all! :frowning:

How can we include/diplay/show a Visitorcounter and the Pageviews in simple text form on a html/php webpage?
(Timeframe should be adjustable/editable, like in the exmaple below: from 07.03.2001 until TODAY)

Example:
“Since this page started at 07.03.2001 we had 19.734 unique visitors from 117 countries who have generated 451.990 explicit pageviews!”

I know that it should be possible to show like EVERYTHING by using the API … but as normal user and non-pro we can’t do it on our own and at least the above mentioned code should be available for everyone as “How To”, as this should be the most needed and

I have searched the new piwik website for hours now and havn’t found anything :frowning:
All i have found is a 7 month old code here in the forum: http://forum.piwik.org/read.php?2,105133,105171#msg-105171
But as this has been written in times of piwik 1.x i do not know if this still will work with the API of piwik 2.0.3+ or if there is a better solution available in the meanwhile?!

It would be also great if this counters (mentioned/requested above) won’t slow down the site and may be delivered to the site when availble. So the site won’t stuck if piwik needs some seconds to calculate the numbers).

Who can help with this and make some “How To” and API code (php) to make this work?

I would appreciate every help and a working code/solution.

Thank you very very much! (tu)

Can you try this plugin? http://plugins.piwik.org/Counter

This graphical counter plugin seems to do a lot of features, but I havent tested it yet

[quote=matt]
Can you try this plugin? http://plugins.piwik.org/Counter[/quote]

Hi Matt!

i have already seen this plugin and check the details page. Wasn’t trying it yet as something i read there wasn’t satisfying my needs i think. But i gonna install and test it. As soon as i have done i will write more about it. be right back :wink:

Thanks for trying to help me matt! (tu)

yamyam reply to you email…
My plugin works is little bit different that you requests. I need more time(busy on other project) to implement what you want.

[quote=Viper]
yamyam reply to you email…
My plugin works is little bit different that you requests. I need more time(busy on other project) to implement what you want.[/quote]

Hi Viper!

Thanks for your answer and i appreciate the work you invest into the plugin! (tu)

So you think you could include my “requests” as shown in my example so all following data (including amounts of countries) will be editable as TEXT?

Example:
“Since this page started at 07.03.2001 we had 19.734 unique visitors from 117 countries who have generated 451.990 explicit pageviews!”

So i would need:

  • amount of unique visitors
  • amount of countries
  • amount of pageviews
    … for a defined timeframe (like 07.03.2011 until today)

All in an editable text-sentence.

This would be awesome!!! … and i would be very thankful for this.

If it will work as i need it i would even send you some little “tahnk you” donation on paypal, if you send me your paypal adress on private message.

Thanks!

Hello together,
-great piwik counter plugin! I played arround with the image based counter for visits and hits, -works great. I had no problems.

-But since two days I try to add the “Live visitors counter” in text-form to my website… ----it just does not work, -I’m to stupid… - I’m not fit with java script, ajax, php…
Is there somewhere a step by step tutorial, I found nothing in the web.
Maybe here someone can help and give an example what to fill in “Element ID on the page” and how the html-javascript on the website must look??

Thank you very much, -and sorry for my maybe stupid question, -but I am not coming forward…
Bleki

Hello again,

I forgot… I’m using Piwik 3.0.4 with plugin Counter (v2.1.1) by Viper…
My homepage is made with JIMDO, so at the page I can use javascript and html, -but no php.

The pic-based counter works perfekt, but the text-live-visitors-counter dosn’t…

…I’m still not successful… -the last days I tried hundred ways to show the live-visitors as simple text… -I have failed and need some help…

Best regards,
Bleki

Hi @Bleki,

you probably want to check out the Live API:
https://demo.piwik.org/index.php?module=API&action=listAllAPI&idSite=3&period=day&date=yesterday
E.g. this request returns the number of visitors in the last 60 minutes:
https://demo.piwik.org/index.php?module=API&method=Live.getCounters&idSite=3&lastMinutes=60&format=JSON&token_auth=anonymous

But there is a reason why most of the solutions are using PHP: To access this data you need to authenticate with a token. But you probably don’t want to include it in your website as this means everyone having the token (read: everyone) can read (and if you use your admin account even modify) everything on your piwik instance.

Because of that I’d recommend to access the data server side. (Which won’t really work on something like JIMDO)

Maybe someone else knows an solution. (Maybe a plugin that makes only the counter API public)

Hello Findus23,
thank you for your response.
I played around with API, -and I was able to show the live-visitors on my homepage, BUT, -as you told, the token was shown in the source code… -and this I don’t want.

I think the counter plugin from Viper can do all I need, and I think I’m just a little step away to bring it to work…

I need a step by step tutorial for the live-visitors as text, -just an example what to fill in “Element ID on the page” and how the html-javascript on my homepage must look.

Thank you,
Bleki

Hi you really don’t want to publish the auth_token. I’d recommend you to immediately reset it in your personal settings.

Hi,

I just tried it out and it seems to be exactly what you want.

Just create a Counter with your settings and then enter the ID of the element where the counter should appear in third last textbox (the one directly above Visitors by countries)
(In this case you would write testId into the box)

<span id="testId"></span>

Now you just need to include the script it shows you into your page. It should look like this:

<script type="text/javascript" src="http://piwik.example/index.php?module=Counter&action=live&id=1&type=js"></script>

Make sure to replace http with https if your site is reachable via HTTPS.

Hi Findus23,
thank you for your effort!
exactly the way you described the last days I made/tried it a 100 times… -it don’t work… I must something overlook…

Now I tried it with an another NO-jimdo-site, -direktly at my serverspace, -it failed too… -the text-counter shows nothing -the pic-basesd counter works…

can it be, that I have something to observe, before I can use <span>....</span>??

Thank you,
Bleki

Hi,

Are you getting any errors in the javascript console when it doesn’t work?

Can you maybe send me the URL per direct message, so I can take a look?