The problem with the tracking of the object


(Pavel) #1

Hello.
I have a website, written because of one-application framework with the help of ExtJS.
For each object, I have the following code:

 
define ( 'PIWIK_ENABLE_DISPATCH', false); 
define ( 'PIWIK_ENABLE_ERROR_HANDLER', false); 

require_once __PIWIK_PATH. "/ index.php"; 
require_once __PIWIK_PATH. "/ core / API / Request.php"; 
Piwik_FrontController:: getInstance () -> init (); 

/ / We call the API from a php code 
/ / It will check that you have the necessary rights 
/ / - Either you are loggued in piwik and have a cookie in your browser 
/ / - Or you replace the token_auth = xxx to the request string to authenticate 
$request = new Piwik_API_Request ( 'method = SitesManager.addSite'. 
'&siteName ='. $ type. '_'. $ object_id. 
'&format = original'. 
'&urls [] = http://www.mysite.com'. 
'&token_auth ='. __PIWIK_TOKEN_AUTH 
); 

$newSiteId = $request->process ();

clicking on the object on the page of my site I use the following code:

tracObject: function(guid){
    try {
        var pkBaseURL = "http://mysite.com/piwik/";
        var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", guid);
        piwikTracker.trackPageView();
    } catch( err ) {}
}

In Fire Bug I see next query:

http://mysite.com/piwik/piwik.php?
idsite=72
&url=http%3A%2F%2Fmysite.com%2F
&action_name=
&res=1280x1024
&h=12
&m=14
&s=2
&cookie=1
&urlref=
&dir=0
&fla=1
&pdf=1
&realp=0
&wma=1

If I click first time in the object - new record added on the table “piwik_log_visit”.
But if I do it again - table remains unchanged.

Please help with this problem or give me advice how to track each object on the site.

Thanks.


Best regards, Pavel.


(vipsoft) #2

That’s because of the recognizeVisitor code. You don’t want Piwik to overcount because someone refreshed the page in his/her browser.

Why not use piwikTracker.trackLink()?


(Pavel) #3

quote=vipsoft @ Jul 27 2009, 01:42 PM) [<{POST_SNAPBACK}>[/url]

Why not use piwikTracker.trackLink(][url=http://mysite.com/piwik/piwik.php?idsite=104]http://mysite.com/piwik/piwik.php?idsite=104
&addTransaction=testlink104
&rand=0.4681168057221069
&redirect=0
&data=%7B%7D[/quote]

And now I want see, how many times object “testlink104” was clicked?
I checked DB, but there are no records, contain “testlink104”.

Thanks.


Best regards, Pavel.


(vipsoft) #4

There’s no built-in database logging of custom data. We might build a generic table as an example plugin, but this is inherently application-specific.


(kpv) #5

Hi to all!
I have the same problem.
I use trackPageView() - and all my clicks not logged in piwik_log_visit
I tryed use trackLink() - all clicks log in piwik_log_link_visit_action, but I can’t find widget which will display this data.

Thanks!