Project Files - Piwik Tracker


(atiosis) #1

I know this is dumb, but since we have been having so many issues with Piwik, I just want to make sure I won’t mess up my anything.

In this article (Tracking API - Analytics Platform - Matomo), it ask to move the “PiwikTracker.php” to where my Project Files are. Are we talking about were my piwik folder is?

Please let me know,
style_emoticons/<#EMO_DIR#>/blink.gif
thanks.


(vipsoft) #2

Copy piwik/core/Tracker/PiwikTracker.php to your other project – it could even be on another site.

Note: the current version of PiwikTracker requires allow_url_fopen = On in order to communicate with the Piwik server.


(atiosis) #3

Thanks.
I am not sure what “allow_url_fopen” is.
Is it a configuration in the php.ini? We are currently using php 5.3.3
I will try to give it a shot to the PiwikTracker.php on a server that we have for testing purposes.

I also noticed that the “PiwikTracker.php” is already in my “tracker” folder. Should I replace it with the one I just downloaded? I am now running Piwik 0.6.4

Thanks.


(atiosis) #4

Hello again,
I used the code as follows:

<?php 
// -- Piwik Tracking API init -- 
require_once "piwik/core/Tracker/PiwikTracker.php";
PiwikTracker::$url = 'http://131.94.117.181/sunguide/piwik/';
?>

<?php 
// Example 1: Tracks a pageview for Website id = 1
echo '<img src="'. Piwik_getUrlTrackPageView( $idSite = 1, $customTitle = 'This title will appear in the report Actions > Page titles') . '" alt="" />';
// Example 2: Triggers a Goal conversion for Website id = 1 and Goal id = 2
// $customRevenue is optional and is set to the amount generated by the current transaction (in online shops for example)
echo '<img src="'. Piwik_getUrlTrackGoal( $idSite = 1, $idGoal = 2, $customRevenue = 39) . '" alt="" />';
?>

… and it is not working. Am I missing something?


(Matthieu Aubry) #5

go to this page, then lookup the image URL, then go the image URLs - is there an error there?


(atiosis) #6

Nothing shows there.
There is no image URL whatsoever. style_emoticons/<#EMO_DIR#>/sad.gif
I think it is related to the path to the “PiwikTracker.php”. I have the impression that it is not loading it.


(atiosis) #7

Ok, we found the issue.
For some reason, the code that the control panel generates has this line

PiwikTracker::$url = "http://www.mydomain.com/piwik";

While in your “PiwikTracker.php” file, you have the $url defined as "URL"
So, if someone finds this same issue, by replacing the previous line with this one, it should work.

PiwikTracker::$URL = "http://www.mydomain.com/piwik";

… or at least, you won’t get the WHITE page.

Now, I am having some other issues.
When the code prints on my page, it is not decoding the URL; so my image link looks something like:

<img src="http://mydomain.com/piwik/index.php/piwik.php?idsite=1&rec=1&apiv=1&url=http%3A%2F%2Fmydomain.com%2Findex.php%3F%2Ftravel_info%2Fcameras%2Ftour2%2Finternal&urlref=http%3A%2F%2Fmydomain.com%2Findex.php%3F%2Ftravel_info%2Finternal&rand=515281839&XDEBUG_SESSION_START=&KEY=&cip=000.00.000.00&action_name=tour2" alt="" />

… Any ideas on how to address this?

Thanks


(Matthieu Aubry) #8

[quote=atiosis @ Jul 27 2010, 10:44 PM]

<img src="http://mydomain.com/piwik/index.php/piwik.php?idsite=1&rec=1&apiv=1&url=http%3A%2F%2Fmydomain.com%2Findex.php%3F%2Ftravel_info%2Fcameras%2Ftour2%2Finternal&urlref=http%3A%2F%2Fmydomain.com%2Findex.php%3F%2Ftravel_info%2Finternal&rand=515281839&XDEBUG_SESSION_START=&KEY=&cip=000.00.000.00&action_name=tour2" alt="" />

… Any ideas on how to address this?

Thanks[/quote]

it looks like it should look - what is the issue with this?


(atiosis) #9

The problem is that it is not tracking style_emoticons/<#EMO_DIR#>/sad.gif
We are using php 5.3.3
… and piwik’s version 0.6.4


(Matthieu Aubry) #10

[quote=atiosis @ Jul 28 2010, 09:22 PM]The problem is that it is not tracking style_emoticons/<#EMO_DIR#>/sad.gif
We are using php 5.3.3
… and piwik’s version 0.6.4[/quote]

OK; I added some help in the documentation explaining how to debug the tracking api: http://piwik.org/docs/tracking-api/#toc-de…-tracking-calls

let me know if it helps