Hi there,
i’m currently trying to track actions in my mobile app with Piwik. I use Titanium Mobile (same SDK they used to build the Piwik Mobile App) and Titanium.Network.HTTPClient to call piwik.php.
I kind of reverse engineered the HTTP request a normal browser would do and so far everything works fine.
However my custom variables (the _cvar part) are ignored.
I would like to track some information about the device and operating system. Does anyone know if this is possible?
Code below…
var now = new Date();
var piwikUrl = 'http://piwik.dagobah/piwik.php';
var piwikParams = {
idsite: 1,
rec: 1,
action_name: 'init',
h: now.getHours(),
m: now.getMinutes(),
s: now.getSeconds(),
res: Titanium.Platform.displayCaps.platformWidth+'x'+Titanium.Platform.displayCaps.platformHeight,
_cvar:{
"1": ["appVersion", Titanium.App.version],
"2": ["os", Titanium.Platform.osname],
"3": ["osVersion", Titanium.Platform.osname+' '+Titanium.Platform.version],
"4": ["model", Titanium.Platform.model+' (CPU:'+Titanium.Platform.processorCount+'/DPI:'+Titanium.Platform.displayCaps.dpi+')']
}
};
var xhr = Titanium.Network.createHTTPClient();
xhr.timeout = 2000; // request timeout in msecs
xhr.open('GET', piwikUrl); // set request method and url
xhr.send(piwikParams); // fire request with supplied get parameters