Esempio n. 1
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  * @return mixed
  */
 function archiveDay($notification)
 {
     /* @var $archiveProcessing Piwik_ArchiveProcessing */
     $archiveProcessing = $notification->getNotificationObject();
     if (!$archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName())) {
         return;
     }
     $select = "count(distinct log_visit.idvisitor) as nb_uniq_visitors_returning,\n\t\t\t\tcount(*) as nb_visits_returning,\n\t\t\t\tsum(log_visit.visit_total_actions) as nb_actions_returning,\n\t\t\t\tmax(log_visit.visit_total_actions) as max_actions_returning,\n\t\t\t\tsum(log_visit.visit_total_time) as sum_visit_length_returning,\n\t\t\t\tsum(case log_visit.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) as bounce_count_returning,\n\t\t\t\tsum(case log_visit.visit_goal_converted when 1 then 1 else 0 end) as nb_visits_converted_returning";
     $from = "log_visit";
     $where = "log_visit.visit_last_action_time >= ?\n\t\t\t\tAND log_visit.visit_last_action_time <= ?\n\t\t \t\tAND log_visit.idsite = ?\n\t\t \t\tAND log_visit.visitor_returning >= 1";
     $bind = array($archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite);
     $query = $archiveProcessing->getSegment()->getSelectQuery($select, $from, $where, $bind);
     $row = $archiveProcessing->db->fetchRow($query['sql'], $query['bind']);
     if ($row === false || $row === null) {
         $row['nb_visits_returning'] = 0;
         $row['nb_actions_returning'] = 0;
         $row['max_actions_returning'] = 0;
         $row['sum_visit_length_returning'] = 0;
         $row['bounce_count_returning'] = 0;
         $row['nb_visits_converted_returning'] = 0;
     }
     foreach ($row as $name => $value) {
         $archiveProcessing->insertNumericRecord($name, $value);
     }
 }
Esempio n. 2
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function getJsFiles($notification)
 {
     $jsFiles =& $notification->getNotificationObject();
     $jsFiles[] = "libs/jquery/jquery.js";
     $jsFiles[] = "libs/jquery/jquery-ui.js";
     $jsFiles[] = "libs/jquery/jquery.tooltip.js";
     $jsFiles[] = "libs/jquery/jquery.truncate.js";
     $jsFiles[] = "libs/jquery/jquery.scrollTo.js";
     $jsFiles[] = "libs/jquery/jquery.history.js";
     $jsFiles[] = "libs/swfobject/swfobject.js";
     $jsFiles[] = "libs/javascript/sprintf.js";
     $jsFiles[] = "themes/default/common.js";
     $jsFiles[] = "plugins/CoreHome/templates/tooltip.js";
     $jsFiles[] = "plugins/CoreHome/templates/datatable.js";
     $jsFiles[] = "plugins/CoreHome/templates/datatable_rowactions.js";
     $jsFiles[] = "plugins/CoreHome/templates/popover.js";
     $jsFiles[] = "plugins/CoreHome/templates/broadcast.js";
     $jsFiles[] = "plugins/CoreHome/templates/menu.js";
     $jsFiles[] = "plugins/CoreHome/templates/calendar.js";
     $jsFiles[] = "plugins/CoreHome/templates/date.js";
     $jsFiles[] = "plugins/CoreHome/templates/autocomplete.js";
     $jsFiles[] = "plugins/CoreHome/templates/sparkline.js";
     $jsFiles[] = "plugins/CoreHome/templates/jqplot.js";
     $jsFiles[] = "libs/jqplot/jqplot-custom.min.js";
 }
Esempio n. 3
0
 /**
  * Gets all scheduled tasks executed by this plugin.
  * 
  * @param Piwik_Event_Notification $notification  notification object
  */
 public function getScheduledTasks($notification)
 {
     $tasks =& $notification->getNotificationObject();
     $priority = Piwik_ScheduledTask::LOWEST_PRIORITY;
     $cacheDataByArchiveNameReportsTask = new Piwik_ScheduledTask($this, 'cacheDataByArchiveNameReports', new Piwik_ScheduledTime_Weekly(), $priority);
     $tasks[] = $cacheDataByArchiveNameReportsTask;
 }
Esempio n. 4
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function getCssFiles($notification)
 {
     $cssFiles =& $notification->getNotificationObject();
     $cssFiles[] = "plugins/CoreHome/templates/styles.css";
     $cssFiles[] = "plugins/CoreHome/templates/datatable.css";
     $cssFiles[] = "plugins/CoreHome/templates/cloud.css";
     $cssFiles[] = "plugins/Dashboard/templates/dashboard.css";
 }
Esempio n. 5
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function addUniqueVisitorsColumnToGivenReport($notification)
 {
     $view = $notification->getNotificationInfo();
     $view = $view['view'];
     if ($view->getCurrentControllerName() == 'Referers' && $view->getCurrentControllerAction() == 'getWebsites') {
         $view->addColumnToDisplay('nb_uniq_visitors');
     }
 }
Esempio n. 6
0
	/**
	 * Hooks when a website tracker cache is flushed (website updated, cache deleted, or empty cache)
	 * Will record in the tracker config file all data needed for this website in Tracker.
	 *
	 * @param Piwik_Event_Notification $notification
	 * @return void
	 */
	function recordWebsiteDataInCache($notification)
	{
		$idSite = $notification->getNotificationInfo();
		// add the 'hosts' entry in the website array
		$array =& $notification->getNotificationObject();
		$array['hosts'] = $this->getTrackerHosts($idSite);
		$array['excluded_ips'] = $this->getTrackerExcludedIps($idSite);
		$array['excluded_parameters'] = $this->getTrackerExcludedQueryParameters($idSite);
	}
Esempio n. 7
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  * @return mixed
  */
 public function archiveDay($notification)
 {
     $archiveProcessing = $notification->getNotificationObject();
     if (!$archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName())) {
         return;
     }
     $this->archiveDayAggregateVisits($archiveProcessing);
     $this->archiveDayAggregateGoals($archiveProcessing);
     $this->archiveDayRecordInDatabase($archiveProcessing);
 }
Esempio n. 8
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function getJsFiles($notification)
 {
     $jsFiles =& $notification->getNotificationObject();
     $jsFiles[] = "libs/jquery/jquery.js";
     $jsFiles[] = "libs/jquery/jquery-ui.js";
     $jsFiles[] = "libs/javascript/sprintf.js";
     $jsFiles[] = "themes/default/common.js";
     $jsFiles[] = "libs/jquery/jquery.history.js";
     $jsFiles[] = "plugins/CoreHome/templates/broadcast.js";
     $jsFiles[] = "plugins/CoreAdminHome/templates/generalSettings.js";
 }
 /**
  * Hooks when a website tracker cache is flushed (website/user updated, cache deleted, or empty cache)
  * Will record in the tracker config file the list of Admin token_auth for this website. This 
  * will be used when the Tracking API is used with setIp(), setForceDateTime(), setVisitorId(), etc. 
  * 
  * @param Piwik_Event_Notification $notification
  * @return void
  */
 function recordAdminUsersInCache($notification)
 {
     $idSite = $notification->getNotificationInfo();
     // add the 'hosts' entry in the website array
     $users = Piwik_UsersManager_API::getInstance()->getUsersWithSiteAccess($idSite, 'admin');
     $tokens = array();
     foreach ($users as $user) {
         $tokens[] = $user['token_auth'];
     }
     $array =& $notification->getNotificationObject();
     $array['admin_token_auth'] = $tokens;
 }
Esempio n. 10
0
 /**
  * Hooks when a website tracker cache is flushed (website updated, cache deleted, or empty cache)
  * Will record in the tracker config file all data needed for this website in Tracker.
  *
  * @param Piwik_Event_Notification $notification  notification object
  * @return void
  */
 function recordWebsiteDataInCache($notification)
 {
     $idSite = $notification->getNotificationInfo();
     // add the 'hosts' entry in the website array
     $array =& $notification->getNotificationObject();
     $array['hosts'] = $this->getTrackerHosts($idSite);
     $website = Piwik_SitesManager_API::getInstance()->getSiteFromId($idSite);
     $array['excluded_ips'] = $this->getTrackerExcludedIps($website);
     $array['excluded_parameters'] = self::getTrackerExcludedQueryParameters($website);
     $array['sitesearch'] = $website['sitesearch'];
     $array['sitesearch_keyword_parameters'] = $this->getTrackerSearchKeywordParameters($website);
     $array['sitesearch_category_parameters'] = $this->getTrackerSearchCategoryParameters($website);
 }
Esempio n. 11
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function checkHeader($notification)
 {
     if (isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1' || isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1') {
         $exclude =& $notification->getNotificationObject();
         $exclude = true;
         printDebug("DoNotTrack found.");
         $trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie();
         $trackingCookie->delete();
         // this is an optional supplement to the site's tracking status resource at:
         //     /.well-known/dnt
         // per Tracking Preference Expression (draft)
         header('Tk: 1');
     }
 }
 /**
  * Hooks on daily archive to trigger various log processing
  *
  * @param Piwik_Event_Notification $notification
  * @return void
  */
 public function archiveDay($notification)
 {
     $this->interestByCustomVariables = $this->interestByCustomVariablesAndValue = array();
     /**
      * @var Piwik_ArchiveProcessing_Day
      */
     $this->archiveProcessing = $notification->getNotificationObject();
     if (!$this->archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName())) {
         return;
     }
     $this->archiveDayAggregate($this->archiveProcessing);
     $this->archiveDayRecordInDatabase($this->archiveProcessing);
     destroy($this->interestByCustomVariables);
     destroy($this->interestByCustomVariablesAndValue);
 }
Esempio n. 13
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function checkHeader($notification)
 {
     if (isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1' || isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1') {
         $ua = Piwik_Tracker_Visit::getUserAgent($_REQUEST);
         if (strpos($ua, 'MSIE 10') !== false) {
             printDebug("INTERNET EXPLORER 10 Enables DNT by default, so Piwik ignores DNT for all IE10 browsers...");
             return;
         }
         $exclude =& $notification->getNotificationObject();
         $exclude = true;
         printDebug("DoNotTrack found.");
         $trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie();
         $trackingCookie->delete();
         // this is an optional supplement to the site's tracking status resource at:
         //     /.well-known/dnt
         // per Tracking Preference Expression (draft)
         header('Tk: 1');
     }
 }
Esempio n. 14
0
 /**
  * Compute all the actions along with their hierarchies.
  *
  * For each action we process the "interest statistics" :
  * visits, unique visitors, bounce count, sum visit length.
  *
  * @param Piwik_Event_Notification $notification  notification object
  */
 public function archiveDay($notification)
 {
     /* @var $archiveProcessing Piwik_ArchiveProcessing_Day */
     $archiveProcessing = $notification->getNotificationObject();
     if (!$archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName())) {
         return;
     }
     $actionsArchiving = new Piwik_Actions_Archiving($archiveProcessing->idsite);
     return $actionsArchiving->archiveDay($archiveProcessing);
 }
Esempio n. 15
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function deleteDashboardLayout($notification)
 {
     $userLogin = $notification->getNotificationObject();
     Piwik_Query('DELETE FROM ' . Piwik_Common::prefixTable('user_dashboard') . ' WHERE login = ?', array($userLogin));
 }
Esempio n. 16
0
 /**
  * Hooks on daily archive to trigger various log processing
  *
  * @param Piwik_Event_Notification $notification  notification object
  * @return void
  */
 public function archiveDay($notification)
 {
     /**
      * @var Piwik_ArchiveProcessing_Day
      */
     $this->archiveProcessing = $notification->getNotificationObject();
     if (!$this->archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName())) {
         return;
     }
     $this->archiveDayAggregateVisits($this->archiveProcessing);
     $this->archiveDayAggregateGoals($this->archiveProcessing);
     Piwik_PostEvent('Referers.archiveDay', $this);
     $this->archiveDayRecordInDatabase($this->archiveProcessing);
     $this->cleanup();
 }
Esempio n. 17
0
 /**
  * Authenticate user and initializes the session.
  * Listens to Login.initSession hook.
  *
  * @param Piwik_Event_Notification $notification  notification object
  * @throws Exception
  */
 function initSession($notification)
 {
     $info = $notification->getNotificationObject();
     $login = $info['login'];
     $md5Password = $info['md5Password'];
     $rememberMe = $info['rememberMe'];
     $tokenAuth = Piwik_UsersManager_API::getInstance()->getTokenAuth($login, $md5Password);
     $auth = Zend_Registry::get('auth');
     $auth->setLogin($login);
     $auth->setTokenAuth($tokenAuth);
     $authResult = $auth->authenticate();
     $authCookieName = Piwik_Config::getInstance()->General['login_cookie_name'];
     $authCookieExpiry = $rememberMe ? time() + Piwik_Config::getInstance()->General['login_cookie_expire'] : 0;
     $authCookiePath = Piwik_Config::getInstance()->General['login_cookie_path'];
     $cookie = new Piwik_Cookie($authCookieName, $authCookieExpiry, $authCookiePath);
     if (!$authResult->isValid()) {
         $cookie->delete();
         throw new Exception(Piwik_Translate('Login_LoginPasswordNotCorrect'));
     }
     $cookie->set('login', $login);
     $cookie->set('token_auth', $auth->getHashTokenAuth($login, $authResult->getTokenAuth()));
     $cookie->setSecure(Piwik::isHttps());
     $cookie->setHttpOnly(true);
     $cookie->save();
     @Piwik_Session::regenerateId();
     // remove password reset entry if it exists
     self::removePasswordResetInfo($login);
 }
Esempio n. 18
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 public function getCssFiles($notification)
 {
     $cssFiles =& $notification->getNotificationObject();
     $cssFiles[] = "plugins/API/css/styles.css";
 }
Esempio n. 19
0
 /**
  * This function executes when the 'Goals.getReportsWithGoalMetrics' event fires. It
  * adds the 'visits to conversion' report metadata to the list of goal reports so
  * this report will be displayed.
  *
  * @param Piwik_Event_Notification $notification  notification object
  */
 function getActualReportsWithGoalMetrics($notification)
 {
     $dimensions =& $notification->getNotificationObject();
     $dimensions = array_merge($dimensions, array(array('category' => Piwik_Translate('General_Visit'), 'name' => Piwik_Translate('Goals_VisitsUntilConv'), 'module' => 'Goals', 'action' => 'getVisitsUntilConversion'), array('category' => Piwik_Translate('General_Visit'), 'name' => Piwik_Translate('Goals_DaysToConv'), 'module' => 'Goals', 'action' => 'getDaysToConversion')));
 }
Esempio n. 20
0
 /**
  * Hooks on the Daily archiving.
  * Will process Goal stats overall and for each Goal.
  * Also processes the New VS Returning visitors conversion stats.
  *
  * @param Piwik_Event_Notification $notification
  * @return void
  */
 function archiveDay($notification)
 {
     /**
      * @var Piwik_ArchiveProcessing_Day
      */
     $archiveProcessing = $notification->getNotificationObject();
     if (!$archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName())) {
         return;
     }
     $this->archiveGeneralGoalMetrics($archiveProcessing);
     $this->archiveEcommerceItems($archiveProcessing);
 }
Esempio n. 21
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 public function getReportMetadata($notification)
 {
     $reports =& $notification->getNotificationObject();
     $reports[] = array('category' => Piwik_Translate('VisitsSummary_VisitsSummary'), 'name' => Piwik_Translate('VisitsSummary_VisitsSummary'), 'module' => 'VisitsSummary', 'action' => 'get', 'metrics' => array('nb_uniq_visitors', 'nb_visits', 'nb_actions', 'nb_actions_per_visit', 'bounce_rate', 'avg_time_on_site' => Piwik_Translate('General_VisitDuration'), 'max_actions' => Piwik_Translate('General_ColumnMaxActions')), 'processedMetrics' => false, 'order' => 1);
 }
Esempio n. 22
0
 /**
  * @param Piwik_Event_Notification $notification notification object
  */
 function deleteUserReport($notification)
 {
     $userLogin = $notification->getNotificationObject();
     Piwik_Query('DELETE FROM ' . Piwik_Common::prefixTable('report') . ' WHERE login = ?', $userLogin);
 }
Esempio n. 23
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  * @return mixed
  */
 public function getReportMetadata($notification)
 {
     $info = $notification->getNotificationInfo();
     $reports =& $notification->getNotificationObject();
     $idSites = $info['idSites'];
     // If only one website is selected, we add the Graph URL
     if (count($idSites) != 1) {
         return;
     }
     $idSite = reset($idSites);
     // in case API.getReportMetadata was not called with date/period we use sane defaults
     if (empty($info['period'])) {
         $info['period'] = 'day';
     }
     if (empty($info['date'])) {
         $info['date'] = 'today';
     }
     // need two sets of period & date, one for single period graphs, one for multiple periods graphs
     if (Piwik_Archive::isMultiplePeriod($info['date'], $info['period'])) {
         $periodForMultiplePeriodGraph = $info['period'];
         $dateForMultiplePeriodGraph = $info['date'];
         $periodForSinglePeriodGraph = 'range';
         $dateForSinglePeriodGraph = $info['date'];
     } else {
         $periodForSinglePeriodGraph = $info['period'];
         $dateForSinglePeriodGraph = $info['date'];
         $piwikSite = new Piwik_Site($idSite);
         if ($periodForSinglePeriodGraph == 'range') {
             $periodForMultiplePeriodGraph = Piwik_Config::getInstance()->General['graphs_default_period_to_plot_when_period_range'];
             $dateForMultiplePeriodGraph = $dateForSinglePeriodGraph;
         } else {
             $periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
             $dateForMultiplePeriodGraph = Piwik_Controller::getDateRangeRelativeToEndDate($periodForSinglePeriodGraph, 'last' . self::GRAPH_EVOLUTION_LAST_PERIODS, $dateForSinglePeriodGraph, $piwikSite);
         }
     }
     $token_auth = Piwik_Common::getRequestVar('token_auth', false);
     $urlPrefix = "index.php?";
     foreach ($reports as &$report) {
         $parameters = array();
         $parameters['module'] = 'API';
         $parameters['method'] = 'ImageGraph.get';
         $parameters['idSite'] = $idSite;
         $parameters['apiModule'] = $report['module'];
         $parameters['apiAction'] = $report['action'];
         if (!empty($token_auth)) {
             $parameters['token_auth'] = $token_auth;
         }
         // Forward custom Report parameters to the graph URL
         if (!empty($report['parameters'])) {
             $parameters = array_merge($parameters, $report['parameters']);
         }
         if (empty($report['dimension'])) {
             $parameters['period'] = $periodForMultiplePeriodGraph;
             $parameters['date'] = $dateForMultiplePeriodGraph;
         } else {
             $parameters['period'] = $periodForSinglePeriodGraph;
             $parameters['date'] = $dateForSinglePeriodGraph;
         }
         // add the idSubtable if it exists
         $idSubtable = Piwik_Common::getRequestVar('idSubtable', false);
         if ($idSubtable !== false) {
             $parameters['idSubtable'] = $idSubtable;
         }
         $report['imageGraphUrl'] = $urlPrefix . Piwik_Url::getQueryStringFromParameters($parameters);
     }
 }
Esempio n. 24
0
 /**
  * Period archiving: simply sums up daily archives
  *
  * @param Piwik_Event_Notification $notification  notification object
  * @return void
  */
 function archivePeriod($notification)
 {
     $archiveProcessing = $notification->getNotificationObject();
     if (!$archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName())) {
         return;
     }
     $maximumRowsInDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];
     $dataTableToSum = array('UserSettings_configuration', 'UserSettings_os', 'UserSettings_browser', 'UserSettings_browserType', 'UserSettings_resolution', 'UserSettings_wideScreen', 'UserSettings_plugin');
     $archiveProcessing->archiveDataTable($dataTableToSum, null, $maximumRowsInDataTable);
 }
Esempio n. 25
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  * @return mixed
  */
 public function getReportMetadata($notification)
 {
     $info = $notification->getNotificationInfo();
     $reports =& $notification->getNotificationObject();
     $idSites = $info['idSites'];
     // If only one website is selected, we add the Graph URL
     if (count($idSites) != 1) {
         return;
     }
     $idSite = reset($idSites);
     // in case API.getReportMetadata was not called with date/period we use sane defaults
     if (empty($info['period'])) {
         $info['period'] = 'day';
     }
     if (empty($info['date'])) {
         $info['date'] = 'today';
     }
     // need two sets of period & date, one for single period graphs, one for multiple periods graphs
     if (Piwik_Archive::isMultiplePeriod($info['date'], $info['period'])) {
         $periodForMultiplePeriodGraph = $info['period'];
         $dateForMultiplePeriodGraph = $info['date'];
         $periodForSinglePeriodGraph = 'range';
         $dateForSinglePeriodGraph = $info['date'];
     } else {
         $periodForSinglePeriodGraph = $info['period'];
         $dateForSinglePeriodGraph = $info['date'];
         $piwikSite = new Piwik_Site($idSite);
         if ($periodForSinglePeriodGraph == 'range') {
             $periodForMultiplePeriodGraph = Piwik_Config::getInstance()->General['graphs_default_period_to_plot_when_period_range'];
             $dateForMultiplePeriodGraph = $dateForSinglePeriodGraph;
         } else {
             $periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
             $dateForMultiplePeriodGraph = Piwik_Controller::getDateRangeRelativeToEndDate($periodForSinglePeriodGraph, 'last' . self::GRAPH_EVOLUTION_LAST_PERIODS, $dateForSinglePeriodGraph, $piwikSite);
         }
     }
     $token_auth = Piwik_Common::getRequestVar('token_auth', false);
     $urlPrefix = "index.php?";
     foreach ($reports as &$report) {
         $reportModule = $report['module'];
         $reportAction = $report['action'];
         $reportUniqueId = $reportModule . '_' . $reportAction;
         $parameters = array();
         $parameters['module'] = 'API';
         $parameters['method'] = 'ImageGraph.get';
         $parameters['idSite'] = $idSite;
         $parameters['apiModule'] = $reportModule;
         $parameters['apiAction'] = $reportAction;
         if (!empty($token_auth)) {
             $parameters['token_auth'] = $token_auth;
         }
         // Forward custom Report parameters to the graph URL
         if (!empty($report['parameters'])) {
             $parameters = array_merge($parameters, $report['parameters']);
         }
         if (empty($report['dimension'])) {
             $parameters['period'] = $periodForMultiplePeriodGraph;
             $parameters['date'] = $dateForMultiplePeriodGraph;
         } else {
             $parameters['period'] = $periodForSinglePeriodGraph;
             $parameters['date'] = $dateForSinglePeriodGraph;
         }
         // add the idSubtable if it exists
         $idSubtable = Piwik_Common::getRequestVar('idSubtable', false);
         if ($idSubtable !== false) {
             $parameters['idSubtable'] = $idSubtable;
         }
         $report['imageGraphUrl'] = $urlPrefix . Piwik_Url::getQueryStringFromParameters($parameters);
         // thanks to API.getRowEvolution, reports with dimensions can now be plotted using an evolution graph
         // however, most reports with a fixed set of dimension values are excluded
         // this is done so Piwik Mobile and Scheduled Reports do not display them
         if (empty($report['constantRowsCount']) || in_array($reportUniqueId, self::$CONSTANT_ROW_COUNT_REPORT_EXCEPTIONS)) {
             $parameters['period'] = $periodForMultiplePeriodGraph;
             $parameters['date'] = $dateForMultiplePeriodGraph;
             $report['imageGraphEvolutionUrl'] = $urlPrefix . Piwik_Url::getQueryStringFromParameters($parameters);
         }
     }
 }
Esempio n. 26
0
    /**
     * @param Piwik_Event_Notification $notification  notification object
     */
    public static function footerUserCountry($notification)
    {
        $out =& $notification->getNotificationObject();
        $out = '</div>
			<div id="rightcolumn">
			<h2>' . Piwik_Translate('Provider_WidgetProviders') . '</h2>';
        $out .= Piwik_FrontController::getInstance()->fetchDispatch('Provider', 'getProvider');
        $out .= '</div>';
    }
Esempio n. 27
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function getCssFiles($notification)
 {
     $cssFiles =& $notification->getNotificationObject();
     $cssFiles[] = "plugins/MultiSites/templates/styles.css";
 }
Esempio n. 28
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function getJsFiles($notification)
 {
     $jsFiles =& $notification->getNotificationObject();
     $jsFiles[] = "plugins/Feedback/templates/feedback.js";
 }
Esempio n. 29
0
 /**
  * Hooks on the Daily archiving.
  * Will process Goal stats overall and for each Goal. 
  * Also processes the New VS Returning visitors conversion stats.
  *
  * @param Piwik_Event_Notification $notification
  * @return void
  */
 function archiveDay($notification)
 {
     /**
      * @var Piwik_ArchiveProcessing_Day 
      */
     $archiveProcessing = $notification->getNotificationObject();
     if (!$archiveProcessing->shouldProcessReportsForPlugin($this->getPluginName())) {
         return;
     }
     // by processing visitor_returning segment, we can also simply sum and get stats for all goals.
     $query = $archiveProcessing->queryConversionsByDimension('visitor_returning');
     if ($query === false) {
         return;
     }
     $nb_conversions = $revenue = $nb_visits_converted = 0;
     $goals = $goalsByVisitorReturning = array();
     while ($row = $query->fetch()) {
         $goalsByVisitorReturning[$row['idgoal']][$row['label']] = $archiveProcessing->getGoalRowFromQueryRow($row);
         if (!isset($goals[$row['idgoal']])) {
             $goals[$row['idgoal']] = $archiveProcessing->getNewGoalRow();
         }
         $archiveProcessing->updateGoalStats($row, $goals[$row['idgoal']]);
         $revenue += $row[Piwik_Archive::INDEX_GOAL_REVENUE];
         $nb_conversions += $row[Piwik_Archive::INDEX_GOAL_NB_CONVERSIONS];
         $nb_visits_converted += $row[Piwik_Archive::INDEX_GOAL_NB_VISITS_CONVERTED];
     }
     // Stats by goal, for all visitors
     foreach ($goals as $idgoal => $values) {
         foreach ($values as $metricId => $value) {
             $metricName = Piwik_Archive::$mappingFromIdToNameGoal[$metricId];
             $recordName = self::getRecordName($metricName, $idgoal);
             $archiveProcessing->insertNumericRecord($recordName, $value);
         }
         $conversion_rate = $this->getConversionRate($values[Piwik_Archive::INDEX_GOAL_NB_CONVERSIONS], $archiveProcessing);
         $recordName = self::getRecordName('conversion_rate', $idgoal);
         $archiveProcessing->insertNumericRecord($recordName, $conversion_rate);
     }
     // Stats by goal, for visitor returning / non returning
     foreach ($goalsByVisitorReturning as $idgoal => $values) {
         foreach ($values as $visitor_returning => $goalValues) {
             foreach ($goalValues as $metricId => $value) {
                 $metricName = Piwik_Archive::$mappingFromIdToNameGoal[$metricId];
                 $recordName = self::getRecordName($metricName, $idgoal, $visitor_returning);
                 $archiveProcessing->insertNumericRecord($recordName, $value);
                 //					echo $record . "<br />";
             }
         }
     }
     // Stats for all goals
     $totalAllGoals = array(self::getRecordName('conversion_rate') => $this->getConversionRate($archiveProcessing->getNumberOfVisitsConverted(), $archiveProcessing), self::getRecordName('nb_conversions') => $nb_conversions, self::getRecordName('nb_visits_converted') => $nb_visits_converted, self::getRecordName('revenue') => $revenue);
     foreach ($totalAllGoals as $recordName => $value) {
         $archiveProcessing->insertNumericRecord($recordName, $value);
     }
 }
Esempio n. 30
0
 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function getCssFiles($notification)
 {
     $cssFiles =& $notification->getNotificationObject();
     $cssFiles[] = "plugins/ExampleRssWidget/templates/styles.css";
 }