This Phonegap plugin appears to provide a simple way to track hybrid Android app usage with Piwik. I added the plugin to my Phonegap jQuery Mobile template project and modified app.js as follows
$(document).on("deviceready", function() {
deviceReadyDeferred.resolve();
alert('piwik track');
piwik.startTracker('https://example.com/piwik/piwik.php','appID');
alert('Device Ready');
});
where appID is what appears in my newly set up “All Websites” list when I log in to Piwik. For good measure I have ensured that I have
<access origin="*" />
<access origin="https://example.com"/>
in my Phonegap config.xml file. I have a button on the page in question which has its Click event wired up to do as follows
alert('Click Me');
piwik.trackEvent('click','Click Me');
I built the APK, installed it on my Android phone, opened it and clicked the button. I went to my Piwik admin panel then to Actions:Events. I had expected it to show me the click event entry but it remains stubbornly blank. What am I doing wrong here.
I should mention the following
[ol]
[li] I am working with Phonegap CLI v 5.3.6
[/li][li] I have plenty of error checking in my code to ensure that it is not stalling somewhere else
[/li][li] My Piwik instllation is at https://example.com/piwik/piwik.php
[/li][/ol]
I have been able to get Google Analytics working in Phonegap Android hybrid apps with little difficulty with the help of this plugin. However, Piwik does not work. I hope that someone on this forum will be able to put me on the right track - I much prefer Piwik to GA.