Include Piwik with PHP


#1

Hi from France :slight_smile:

Is it possible to call Piwik in my website with PHP and not JavaScript ?

Thanks a lot.


(Thomas Seifert) #2

http://piwik.org/docs/tracking-api/#toc-how-to-use-the-php-tracker-api-example


#3

Thanks.

I’ve ever seen this link, I’va added this code


require_once $_SERVER['DOCUMENT_ROOT']."/piwik/PiwikTracker.php";
PiwikTracker::$URL = 'http://192.168.1.13/';

$t = new PiwikTracker( $idSite = 1, 'http://192.168.1.13/piwik/');

in my index.php page but it doesn’t work :frowning:

Can you help me ?


(Thomas Seifert) #4

Is that URL reachable from your server at all?
Is the code at the given Path (document_root/piwik/… ) ?


#5

Oh I’ve made a mistake on my code :

I replaced the line 2 with :


PiwikTracker::$URL = 'http://192.168.1.13/piwik/';

and deleted the line 3.

It’s working now :slight_smile:

Thank’s to you