How can I know `idvisit` when the trackLink is triggered


(cn_Dark) #1

I want to create a plugin of e_commerce, and the function PiwikTracker.tackLink is very userful.

How can I know idvisit when the trackLink is triggered?

For example, my client use tracking code like this:

[...]
var trans = { 'orderId' : order_id,
'storeId' : store_id,
'total' : total,
'city' : city,
'state' : state,
'country' : country,
'skus' : 'A;B;C',
'units' : '1;2;1'
};
piwikTracker.trackLink( '/store', 'addTransaction', trans );
[...]

With Piwik_Common::getRequestVar(‘data’) and json_decode(), I retrieve the customVars named trans. But I also want to show the detail about the client(OS,referer_url,referer_keyword,etc) for my clients, if I can know the idvisit of this track, I can get all the data Piwik retrieved.

I know piwikTracker.trackGoal can do this, but I need to set parameters such as ‘match_attribute’, and it is not useful for my plugin.

Is there any function or API which can do this?