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?