Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17077] BlackBerry: Analytics - ti.enroll event is not sent to the payload

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2014-06-05T17:42:57.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 3.3.0
ComponentsBlackBerry
Labelsanalytics, qe-3.3.0, qe-testadded, regression
ReporterOlga Romero
AssigneePedro Enrique
Created2014-06-04T22:51:39.000+0000
Updated2014-07-25T17:53:16.000+0000

Description

Testing Analytics, we encountered that "ti.enroll" event is not being sent. As a result, we do not see BB installs on a dashboard. It is a regression. Please, compare attachments. Tested the following code
var apm = undefined;
try { apm = require("com.appcelerator.apm"); }
catch (e) { Ti.API.info("com.appcelerator.apm module is not available"); }
apm && apm.init();

var win = Ti.UI.createWindow({backgroundColor:'white'});
var startDate = new Date();
if (Ti.UI.Android){win.windowSoftInputMode = Ti.UI.Android.SOFT_INPUT_ADJUST_PAN;}

function timeOut(){setTimeout(function(){if(Ti.Platform.osname == 'ios' || 'android'){label.text = Ti.Analytics.lastEvent;}},1000);}

function createRow(i) {
  var row = Ti.UI.createView({backgroundColor: 'white', width:'100%', height: '10%', top: 5, left: 0});
  return row;
}

var column1 = Ti.UI.createView({top: 0, left: 0, layout: 'vertical', height:"60%", width:'33%'});
var column2 = Ti.UI.createView({top: 0, layout: 'vertical', height:"60%", width:'33%'});
var column3 = Ti.UI.createView({top: 0, right: 0, layout: 'vertical', height:"60%", width:'33%'});
if(Ti.Platform.osname == 'android'){
	var label = Ti.UI.createLabel({backgroundColor:'#FFF', color:'black', textAlign: 'center', bottom:0, width: '98%', height:'40%'});}
else{
	var label = Ti.UI.createLabel({backgroundColor:'#FFF', color:'black', font: {fontSize: 11}, textAlign: 'center', bottom:0, width: '98%', height:'40%'});}
var border = Ti.UI.createLabel({top:0, height:'1', borderColor:'#EEE', width: Titanium.UI.FILL});
var deprecated = Ti.UI.createLabel({backgroundColor:'#FFF', color:'red', textAlign: 'center', bottom:0, width: Titanium.UI.FILL});

//Testing the Ti.Analytics.addEvent
var testOneButton = Ti.UI.createButton({title: "addEvent", height: '33%', color:'red', width: '100%', top: 0});
testOneButton.addEventListener('click', function(e){
	Ti.Analytics.addEvent('addEventOne', 'addEventTwo', 'addEvent.testButton');
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Add Event"; }
	deprecated.setText("Deprecated 2.0.0");
	win.add(deprecated);
});

//Testing the Ti.Analytics.getLastEvent
var testTwoButton = Ti.UI.createButton({title: "getLastEvent", height: '33%', width: '100%', top: 0});
testTwoButton.addEventListener('click', function(e){
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Get Last Event"; }
	win.remove(deprecated);
});

//Testing the Ti.Analytics.getBubbleParent
var testThreeButton = Ti.UI.createButton({title: "getBubble", height: '33%', width: '100%', top: 0});
testThreeButton.addEventListener('click', function(e){
	Ti.Analytics.getBubbleParent();
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Get Bubble Event"; }
	win.remove(deprecated);
});

//Testing the Ti.Analytics.featureEvent
var testFourButton = Ti.UI.createButton({title: "featureEvent", height: '33%', width: '100%', top: 0});
testFourButton.addEventListener('click', function(e){
	Ti.Analytics.featureEvent('featureEvent', {"value1":"key1"});
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Feature Event"; }
	win.remove(deprecated);
});

//Testing the Ti.Analytics.navEvent
var testFiveButton = Ti.UI.createButton({title: "navEvent", height: '33%', width: '100%', top: 0});
testFiveButton.addEventListener('click', function(e){
	Ti.Analytics.navEvent('navEventOne', 'navEventTwo', 'navEvent.testButton');
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Navigation Event"; }
	win.remove(deprecated);
});

//Testing the Ti.Analytics.timedEvent
var testSixButton = Ti.UI.createButton({title: "timedEvent", height: '33%', color:'red', width: '100%', top: 0});
testSixButton.addEventListener('click', function(e){
	var stopDate = new Date();
	var duration = stopDate - startDate;
	Ti.Analytics.timedEvent('timedEvent.testButton', startDate, stopDate, duration);
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Timed Event"; }
	deprecated.setText("Deprecated 2.0.0");
	win.add(deprecated);
});

//Testing the Ti.Analytics.settingsEvent
var testSevenButton = Ti.UI.createButton({title: "settingsEvent", height: '33%', color:'red', width: '100%', top: 0});
testSevenButton.addEventListener('click', function(e){
	Ti.Analytics.settingsEvent('settingsEvent', 'settingsEvent.testButton');
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Settings Event"; }
	deprecated.setText("Deprecated 2.0.0");
	win.add(deprecated);
});

//Testing the Ti.Analytics.userEvent
var testEightButton = Ti.UI.createButton({title: "userEvent", height: '33%', color:'red', width: '100%', top: 0});
testEightButton.addEventListener('click', function(e){
	Ti.Analytics.userEvent('userEvent', 'userEvent.testButton');
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "User Event"; }
	deprecated.setText("Deprecated 2.0.0");
	win.add(deprecated);
});

//Testing the Ti.Analytics.setBubbleParent
var testNineButton = Ti.UI.createButton({title: "setBubble", height: '33%', width: '100%', top: 0});
testNineButton.addEventListener('click', function(e){
	Ti.Analytics.setBubbleParent(true);
	if(Ti.Platform.osname != 'mobileweb'){ timeOut(); } else { label.text = "Set Event"; }
	win.remove(deprecated);
});

column1.add(testOneButton);
column1.add(testTwoButton);
if(Ti.Platform.osname != 'mobileweb'){
	column1.add(testThreeButton);
}

column2.add(testFourButton);
column2.add(testFiveButton);
column2.add(testSixButton);

column3.add(testSevenButton);
column3.add(testEightButton);
if(Ti.Platform.osname != 'mobileweb'){
	column3.add(testNineButton);
}
if(Ti.Platform.osname != 'mobileweb'){ label.text = Ti.Analytics.lastEvent; }
label.add(border);
win.add(column1);
win.add(column2);
win.add(column3);
win.add(label);
win.open();

Attachments

FileDateSize
3.3.0_bb_analytics.txt2014-06-04T22:51:39.000+0000604
bb_payload.txt2014-06-04T22:51:39.000+00001728
Screen Shot 2014-06-09 at 2.13.12 PM.png2014-06-09T21:16:38.000+000015798

Comments

  1. Pedro Enrique 2014-06-05

    I've looking at the code and the payload and this is what's going on. When the app is starts up it looks for the analytics database file. If that file is not found, then it creates it and sends the "ti.enroll" event - this means that this is the first time the app runs after being installed. The problem is that when the app is uninstalled, the data that was saved does not get deleted and persists even if the app is not longer on the device. So when you install the app a second time, the analytics database exists from the previous install, and therefore the "ti.enroll" event is not sent when it should have been. The "workaround" would be to create a new app every time, or at least change the app id before running it and testing. I'll leave this ticket open for discussion and suggestions on how to accomplish this better.
  2. Olga Romero 2014-06-05

    [~penrique] I tested 5 applications with different guid before filing this ticket. Ready to discuss :)
  3. Pedro Enrique 2014-06-05

    I think I found the issue, it's something else. Working on it at the moment. Details to come
  4. Pedro Enrique 2014-06-05

    PR: https://github.com/appcelerator/titanium_mobile_blackberry/pull/260
  5. Olga Romero 2014-06-05

    Tested with Appcelerator Studio, build: 3.3.0.201405271647 Titanium SDK, build: 3.3.0.v20140605150555

    Actual result

    ti.enroll event sent to the payload
       aguid":"050b2e34-43da-4b6b-a28c-a47f2df55999","type":"ti.enroll","event":"ti.enroll
       
  6. Olga Romero 2014-06-09

    Tested and verified fixed: Mac osx 10.9.3 Mavericks Appcelerator Studio, build: 3.3.0.201406061445 Titanium SDK, build: 3.3.0.v20140606154912 Node.JS Version: v0.10.13 NPM Version: 1.3.2 acs@1.0.14 alloy@1.4.0-beta npm@1.3.2 titanium@3.3.0-beta2 titanium-code-processor@1.1.1 Device: BB Z10 (10.2.1) dashboard.appcelerator.com (please see screenshot)

JSON Source