1

When I call:

require_once '/var/www/html/piwik/piwik.php';,

I get this output:

This resource is part of Piwik. Keep full control of your data with the leading free and open source digital analytics platform for web and mobile.

Why is this? Here is the rest of my code:

require_once '/var/www/html/piwik/piwik.php';
$t = new PiwikTracker($idSite = 1, 'http://localhost/piwik/');
$t->setCustomVariable(1,'Force IP',$_SERVER['REMOTE_ADDR']);
$t->doTrackPageView('Page title');

Am I calling the wrong tracking file for Piwik Tracker?

Any help greatly appreciated.

Community
  • 1
  • 1
regor2
  • 107
  • 1
  • 9

1 Answers1

1

This is because as the error message mentions piwik.php is part of piwik and should therefore never be required from an external php file.

Is it possible you are looking for the php piwik client? https://github.com/piwik/piwik-php-tracker

But if you just want to track page visits most of the time you don’t need it and you only have to include the tracking code.

lw1.at
  • 1,528
  • 11
  • 25
  • OK so Piwik PHP Tracker will do the same thing but not echo that welcome text? I will try it. – regor2 Jul 27 '17 at 21:19
  • Thanks! PHP Tracker it is. I was confused by everything referencing the standard /piwik.php... – regor2 Dec 20 '17 at 00:03