1.5.1 Bug?

I have installed Piwik 1.5.1 onto http://kiss-guild.com and it was working the first month. Though I noticed it appeared to be adding multiple entries due to the no script part as the image is still loaded. However I fixed that due to adding in the PHP code instead. However when I go into Piwik I see "No data for this graph. " for every graph, even while viewing a data range of a year.

The only area I can actually view any data is in the Visitor -> Visitor Log section where I see who has come to the site.

I noticed in the database there were archive tables. I have the cron job installed. I want ALL reports available and want to be able to see everything. I’m not worried about database space or anything.

Enable “browser trigger archiving” in Settings > General settings ?

Doesn’t that defeat the purpose of being able to run a cron? The cron is running every hour at the moment but even after hours upon hours nothing is showing in the admin area besides the visitor logs.

That’s because somehow the cron is not setup properly… check your error logs, and check again: How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo

I turned on email crons and this is the error I’m getting:
“php binary not found. Make sure php5 or php exists in PATH.”

So I fixed it. PATH on my host does not specify the php path. Not something I can change but I was able to after some trial and error skip around this and get the script to work. Here is my finished file (mind the commented debug coding).


#!/bin/sh -e

# Description
# This cron script will automatically run Piwik archiving every hour.
# The script will also run scheduled tasks configured within piwik using
# the event hook 'TaskScheduler.getScheduledTasks'

# It automatically fetches the Super User token_auth
# and triggers the archiving for all websites for all periods.
# This ensures that all reports are pre-computed and Piwik renders very fast.

# Documentation
# Please check the documentation on http://piwik.org/docs/setup-auto-archiving/

# How to setup the crontab job?
# Add the following lines in your crontab file, eg. /etc/cron.d/piwik-archive
#---------------START CRON TAB--
#MAILTO="youremail@example.com"
#5 * * * * www-data /path/to/piwik/misc/cron/archive.sh > /dev/null
#-----------------END CRON TAB--
# When an error occurs (eg. php memory error, timeout) the error messages
# will be sent to youremail@example.com.
#
# Optimization for high traffic websites
# You may want to override the following settings in config/config.ini.php:
# See documentation of the fields in your piwik/config/config.ini.php
#
# [General]
# time_before_archive_considered_outdated = 3600
# enable_browser_archiving_triggering = false
#===========================================================================
# PATH = "$PATH:/usr/local/php5/bin/php"

# for TEST_PHP_BIN in php5 php php-cli php-cgi; do
  # if which $TEST_PHP_BIN >/dev/null 2>/dev/null; then
    # PHP_BIN=`which $TEST_PHP_BIN`
    # break
  # fi
# done
# if test -z $PHP_BIN; then
  # echo "PATH: $PATH" >&2
  # echo "php binary not found. Make sure php5 or php exists in PATH." >&2
  # exit 1
# fi
# PHP_BIN = "/usr/local/php5/bin/php"
DUMMY="/usr/local/php5/bin/php"

act_path() {
  local pathname="$1"
  readlink -f "$pathname" 2>/dev/null || \
  realpath "$pathname" 2>/dev/null || \
  type -P "$pathname" 2>/dev/null
}

ARCHIVE=`act_path ${0}`
PIWIK_CRON_FOLDER=`dirname ${ARCHIVE}`
PIWIK_PATH="$PIWIK_CRON_FOLDER"/../../index.php
PIWIK_CONFIG="$PIWIK_CRON_FOLDER"/../../config/config.ini.php

PIWIK_SUPERUSER=`sed '/^\[superuser\]/,$!d;/^login[ \t]*=[ \t]*"*/!d;s///;s/"*[ \t]*$//;q' $PIWIK_CONFIG`
PIWIK_SUPERUSER_MD5_PASSWORD=`sed '/^\[superuser\]/,$!d;/^password[ \t]*=[ \t]*"*/!d;s///;s/"*[ \t]*$//;q' $PIWIK_CONFIG`

CMD_TOKEN_AUTH="$DUMMY -q $PIWIK_PATH -- module=API&method=UsersManager.getTokenAuth&userLogin=$PIWIK_SUPERUSER&md5Password=$PIWIK_SUPERUSER_MD5_PASSWORD&format=php&serialize=0"
TOKEN_AUTH=`$CMD_TOKEN_AUTH`

CMD_GET_ID_SITES="$DUMMY -q $PIWIK_PATH -- module=API&method=SitesManager.getAllSitesId&token_auth=$TOKEN_AUTH&format=csv&convertToUnicode=0"
ID_SITES=`$CMD_GET_ID_SITES`

CMD_GET_SEGMENTS_TO_ARCHIVE="$DUMMY -q $PIWIK_PATH -- module=API&method=CoreAdminHome.getKnownSegmentsToArchive&token_auth=$TOKEN_AUTH&format=csv&convertToUnicode=0"
SEGMENTS_TO_ARCHIVE=`$CMD_GET_SEGMENTS_TO_ARCHIVE`

echo "Starting Piwik reports archiving..."
echo ""
for idsite in $ID_SITES; do
  TEST_IS_NUMERIC=`echo $idsite | egrep '^[0-9]+$'`
  if test -n "$TEST_IS_NUMERIC"; then
    for period in day week month year; do
      echo ""
      echo "Archiving period = $period for idsite = $idsite..."
      CMD="$DUMMY -q $PIWIK_PATH -- module=API&method=VisitsSummary.getVisits&idSite=$idsite&period=$period&date=last52&format=xml&token_auth=$TOKEN_AUTH"
      $CMD
      
      for segment in $SEGMENTS_TO_ARCHIVE; do
	    if test $segment != "value"; then
      	  echo ""
      	  echo " - Archiving for visitor segment $segment ..." 
      	  CMD_ARCHIVE_SEGMENT="${CMD}&segment=$segment"
      	  $CMD_ARCHIVE_SEGMENT
      	fi
      done
    done

    echo ""
    echo "Archiving for idsite = $idsite done!"
  fi
done

echo "Reports archiving finished."
echo "---------------------------"
echo "Starting Scheduled tasks..."
echo ""
CMD="$DUMMY -q $PIWIK_PATH -- module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=$TOKEN_AUTH"
# echo "$CMD"
# echo "$DUMMY"
$CMD
echo ""
echo "Finished Scheduled tasks."
echo ""


Well the above made the cron work. But I’m still not seeing any information on any of the pages besides the visitor log. After updating I now see the date range come up with the date range but there is still no data loading into anything.