Hi,
I’m trying to make a custom tracking plugin that would record data into my own table (ie one that doesn’t exist by default in piwik’s table structure), let’s call it test, after my own trigger. For now I’m using the newVisitorInformation trigger just to test the data recording part.
I have successfully added a table via install() with the following structure:
test(id int, stuff varchar(100), who varchar(100))
I use the following code:
function logMyStuff($notification)
{
$mydata = array( ‘who’ =>‘someone’, ‘id’ => 1);
$db = Zend_Registry::get(‘db’);
$table = Piwik::prefixTable(‘test’);
$db->insert($table, $mydata);
}
This code does nothing and doesn’t throw any errors. I get new visitors but nothing gets added to the test table. (I am checking directly in the db.)
This same code, when put into an API call, works just fine. Also if I add data to the log_visit table via the logMyStuff method, it works too (although it messes up the visitor count, so I definitely need my own table).
I have no idea how to make this code do what I want. Please help!
Maria