Opened 4 years ago

Closed 2 months ago

Last modified 2 months ago

#1773 closed New feature (wontfix)

little VisitsSummary Evolution Wrapper

Reported by: arni Owned by:
Priority: normal Milestone:
Component: Plugins Wishlist Keywords: third-party-plugin
Cc: toarni@… Sensitive: no

Description

This plugin provides three functions:

  • getVisitsSummaryDailyEvolution(idSite, period, date)
  • getVisitsSummaryWeeklyEvolution(idSite, period, date)
  • getVisitsSummaryMonthlyEvolution(idSite, period, date)

In the getVisitsSummaryDailyEvolution function a VisitsSummary.get report is fetched foreach day in given period and date.
The date of each day is added to the according report as label.

example:

Call getVisitsSummaryDailyEvolution
with period = month
and date = yesterday (i.e. 2010-10-16)

return(xml):
<result>

<row>

<label>01.10</label>
<nb_visits>0</nb_visits>
<nb_uniq_visitors>0</nb_uniq_visitors>
<nb_visits_converted>0</nb_visits_converted>
<bounce_count>0</bounce_count>
<sum_visit_length>0</sum_visit_length>
<nb_actions>0</nb_actions>

</row>
<row>

<label>02.10</label>
<nb_visits>0</nb_visits>
<nb_uniq_visitors>0</nb_uniq_visitors>
<nb_visits_converted>0</nb_visits_converted>
<bounce_count>0</bounce_count>
<sum_visit_length>0</sum_visit_length>
<nb_actions>0</nb_actions>

</row>
<row>...</row>
...
...
...
<row>

<label>16.10</label>
<nb_visits>0</nb_visits>
<nb_uniq_visitors>0</nb_uniq_visitors>
<nb_visits_converted>0</nb_visits_converted>
<bounce_count>0</bounce_count>
<sum_visit_length>0</sum_visit_length>
<nb_actions>0</nb_actions>

</row>

</result>



Analogous in getVisitsSummaryWeeklyEvolution every week is fetched for the given date and period.
In getVisitsSummaryMonthlyEvolution every month.

Attachments (1)

VisitsSummaryEvolution.zip (3.6 KB) - added by arni 4 years ago.
VisitsSummaryEvolution Plugin Source

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by arni

VisitsSummaryEvolution Plugin Source

comment:1 Changed 4 years ago by wolfgang2

Installed it but gives me this error:

<?xml version="1.0" encoding="utf-8" ?>
<result>

<error message="This report doesn&acute;t provide any information of it&acute;s dimension." />

</result>

Source: http://en.qi-hardware.com/piwik/index.php?module=API&method=ImageGraph.get&idSite=1&period=month&date=yesterday&apiModule=VisitsSummaryEvolution&apiAction=getVisitsSummaryDailyEvolution

Is it possible to have the daily chart show the last 30 days, instead of starting with the first of the current month?

comment:2 Changed 3 years ago by arni

Hi Wolfgang.

Have you activated the VisitsSummaryEvolution plugin in the piwik settings?

comment:3 Changed 3 years ago by wolfgang2

arni,
ha sorry, I was so excited that I forgot to reply!
First of all - yes - you got me there, I simply had forgotten to enable the plugin.

After a few patches things are working great for me now, you can see the PNG chart at the bottom of our homepage at http://en.qi-hardware.com
It's not properly cached yet, but except for that it's great.

I ended up with a few patches I thought I list here:

---1
In both ImageGraph and VisitsSummaryEvolution, I commented out the checkUser calls, in my case all data is accessible to anonymous, and the plugin should reuse that setting I think.

  • Piwik::checkUserIsNotAnonymous();
  • Piwik::checkUserHasViewAccess($idSite);

+ Piwik::checkUserIsNotAnonymous();
+ Piwik::checkUserHasViewAccess($idSite);

---2
I didn't like the fraction of visitors (333.33), so I changed the number of decimals from 2 to 0. Maybe you can drive that parameter out...

+++ ImageGraph/ImageGraphObject.php
@@ -78,7 +78,7 @@

$this->drawGraphArea(255, 255, 255);

  • $this->drawScale($this->data->GetData(), $this->data->GetDataDescription(), SCALE_START0, 68, 68, 68, true, 0, 2, false);

+ $this->drawScale($this->data->GetData(), $this->data->GetDataDescription(), SCALE_START0, 68, 68, 68, true, 0, 0, false); set decimals to 0

$this->drawGrid(4, true, 230, 230, 230, 255);

---3
I wanted the last 30 days, not the days since 1st of the month:

+++ VisitsSummaryEvolution/API.php
@@ -78,8 +78,8 @@

else if($period == "month")
{

  • $dateHistory = $dateHistory->setDay(1);
  • $dateTemp = Piwik_Date::factory($date)->addPeriod(1, "month")->setDay(1)->subDay(1);

+ $dateTemp = Piwik_Date::factory("yesterday");
+ $dateHistory = Piwik_Date::factory($dateTemp)->subPeriod(1, "month");

---4
I wanted the unique visitors, but I had to 'hide' the value in the nb_visits column because piwik/plugins/API/API.php:handleTableReport() will remove nb_uniq_visitors. Strange I think nb_uniq_visitors should just stay there but there seem to be assumptions in the rest of Piwik about it, so whatever I just patched it to get the result I wanted.

+++ VisitsSummaryEvolution/API.php
@@ -98,7 +98,7 @@

$temp = Piwik_VisitsSummary_API::getInstance()->get($idSite, $evolutionPeriod, $dateHistory)->getFirstRow()->getColumns();

  • $reportTemp[ "nb_visits" ] = $temp[ "nb_visits" ];

+ $reportTemp[ "nb_visits" ] = $temp[ "nb_uniq_visitors" ];

$reportTemp[ "nb_uniq_visitors" ] = $temp[ "nb_visits" ];
$reportTemp[ "nb_visits_converted" ] = $temp[ "nb_visits_converted" ];


Overall - thanks a lot! It all works for me now and I'm sure things will slowly improve over time, hopefully these plugins get integrated into Piwik proper.
Keep up the good work,
Wolfgang

comment:4 Changed 2 months ago by matt (mattab)

  • Resolution set to wontfix
  • Status changed from new to closed

comment:5 Changed 2 months ago by matt (mattab)

  • Keywords third-party-plugin added

Adding third-party-plugin tag to all Piwik 1.x third party plugins. For more information, please visit the Developer docs, the Plugins Marketplace, the themes Marketplace and see #4607

If you have any question or feedback, get in touch in our Piwik developers forum. Happy new year 2014!

comment:6 Changed 2 months ago by matt (mattab)

  • Milestone Third Party Piwik Plugins deleted

Milestone Third Party Piwik Plugins deleted

Note: See TracTickets for help on using tickets.