Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

little VisitsSummary Evolution Wrapper #1773

Closed
anonymous-matomo-user opened this issue Oct 17, 2010 · 4 comments
Closed

little VisitsSummary Evolution Wrapper #1773

anonymous-matomo-user opened this issue Oct 17, 2010 · 4 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.

Comments

@anonymous-matomo-user
Copy link

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.
Keywords: third-party-plugin

@anonymous-matomo-user
Copy link
Author

Attachment: VisitsSummaryEvolution Plugin Source
VisitsSummaryEvolution.zip

@anonymous-matomo-user
Copy link
Author

Installed it but gives me this error:

<?xml version="1.0" encoding="utf-8" ?>
<result>
<error message="This report doesn´t provide any information of it´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?

@anonymous-matomo-user
Copy link
Author

Hi Wolfgang.

Have you activated the VisitsSummaryEvolution plugin in the piwik settings?

@anonymous-matomo-user
Copy link
Author

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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

1 participant