I am sorry, but I did take the time to read the documentation and try and debug the code.
From the documentation my questions 1, 2 and 5 are not clear.
- the docs you referred me to say
“In other words, if you create another custom variable and assign it INDEX 1, then it will start tracking this new variable.”
Yet it doesn’t address what happens after an API call has been made.
The document also says
" Remember you can track up to 5 custom variables per visit and/or up to 5 custom variables per page view."
But once again is not clear if these variables can be different from page to page.
I tested the following call
$user_id = '0000000000000002';
$piwikTracker->setVisitorId( $user_id );
$piwikTracker->setCustomVariable(1, 'test2', 'for test 2', 'visit');
$piwikTracker->setCustomVariable(2, 'test3', 'for test 3', 'visit');
// Sends Tracker request via http
$piwikTracker->doTrackPageView('index.php');
$piwikTracker->setVisitorId( $user_id );
$piwikTracker->setCustomVariable(1, 'test4', 'for test 4', 'visit');
$piwikTracker->setCustomVariable(2, 'test5', 'for test 5', 'visit');
// Sends Tracker request via http
$piwikTracker->doTrackPageView('index.php');
and it only recorded test4 and test5, but if I create a second object for test 4 and 5 it records all actions. I expanded my test to 10 different variables and I was able to record them all. Although there is very odd behavior once I try to record more variables in different pages mainly variable names get changed, or are removed completely from the “custom variable” list.
In question 4 you can see how I tried based on the documentation example here and all I’m getting is an empty response.
Finally question 5 I changed the method doTrackPageView to send the request using post. it seem to record the variables just fine, but I’m not sure if this is a proper way to do it.
Some clarification is appreciated.