( https://marketplace.appcelerator.com/apps/5081?2014113336 )から Google Analytics モジュールをダウンロードしました。
このモジュールを使用してアプリのイベントとダウンロードを追跡する方法がわかりません (モジュールを初めて使用するため)。誰か助けてください。ここに私のコードがあります
//Application Window Component Constructor
function ApplicationWindow() {
var win = Ti.UI.createWindow({
backgroundImage:'ui/handheld/android/images/Background_320x480.png',
tabBarHidden:true
});
win.orientationModes = [Ti.UI.PORTRAIT];
var screenWidth = Ti.Platform.displayCaps.platformWidth;
var screenHeight = Ti.Platform.displayCaps.platformHeight;
function GetHeight(value) {
var temp = (value * 100) / 320;
return parseInt((screenHeight * temp) / 100);
}
function GetWidth(value) {
var temp = (value * 100) / 240;
return parseInt((screenWidth * temp) / 100);
}
var parent = Ti.UI.createView({});
//Set up analytics
var GA = require("analytics.google");
GA.debug = true;
//GA.trackUncaughtExceptions = true;
var tracker = GA.getTracker("UA-41976730-1");
var image1 = Ti.UI.createImageView({
image:"images/settings.png",
top:'10',
right:'8'
});
parent.add(image1);
image1.addEventListener('click', function() {
var win4 = Ti.UI.createWindow({
title: 'Settings',
url: "settings.js",
tabBarHidden:true
});
win4.open({modal:true});
});
var image2 = Ti.UI.createImageView({
image:'images/.png',
layout:'horizontal',
// left: GetWidth(35),
top:40
});
parent.add(image2);
var image3 = Ti.UI.createImageView({
image:'images/NewsButton.png',
top : GetHeight(85),
left : GetWidth(35)
});
parent.add(image3);
image3.addEventListener('click', function() {
var win2 = Ti.UI.createWindow({
title: 'Industry News',
tabBarHidden:true,
backgroundColor:"white"
});
win2.orientationModes = [Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT];
var webview = Titanium.UI.createWebView({
url:''
});
win2.add(webview);
win2.open({modal:true});
});
var label1 = Ti.UI.createLabel({
text:'Industry News',
color:'#0768A9',
width:'auto',
height:'auto',
font:{fontFamily:'Trebuchet MS',fontWeight:'bold'},
top : GetHeight(150),
left : GetWidth(32)
});
parent.add(label1);
var image4 = Ti.UI.createImageView({
image:'images/BlogButton.png',
top : GetHeight(85),
right : GetWidth(35)
});
parent.add(image4);
image4.addEventListener('click', function() {
var win3 = Ti.UI.createWindow({
title: 'Software Alerts',
tabBarHidden:true,
backgroundColor:"white"
});
win3.orientationModes = [Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT];
var webview = Titanium.UI.createWebView({
url:''
});
win3.add(webview);
win3.open({modal:true});
});
var label2 = Ti.UI.createLabel({
text:'Software Alerts',
color:'#0768A9',
width:'auto',
height:'auto',
font:{fontFamily:'Trebuchet MS',fontWeight:'bold'},
top : GetHeight(150),
right : GetWidth(29)
});
parent.add(label2);
var image5 = Ti.UI.createImageView({
image:'images/TVButton.png',
top : GetHeight(185),
left : GetWidth(35)
});
parent.add(image5);
image5.addEventListener('click', function() {
var win4 = Ti.UI.createWindow({
backgroundColor:'#fff',
title: ' TV',
url: "Pages/tv.js",
tabBarHidden:true
});
win4.open({modal:true});
});
var label3 = Ti.UI.createLabel({
text:'TV',
color:'#0768A9',
width:'auto',
height:'auto',
font:{fontFamily:'Trebuchet MS',fontWeight:'bold'},
top : GetHeight(250),
left : GetWidth(50)
});
parent.add(label3);
var image6 = Ti.UI.createImageView({
image:'images/LibraryButton.png',
top : GetHeight(185),
right : GetWidth(35)
});
parent.add(image6);
image6.addEventListener('click', function() {
var win5 = Ti.UI.createWindow({
title: 'Knowledge Library',
tabBarHidden:true
});
win5.orientationModes = [Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT]
var webview = Titanium.UI.createWebView({
url:''
});
win5.add(webview);
win5.open({modal:true});
});
var label4 = Ti.UI.createLabel({
text:'Knowledge Library',
color:'#0768A9',
width:'auto',
height:'auto',
font:{fontFamily:'Trebuchet MS',fontWeight:'bold'},
top : GetHeight(250),
right : GetWidth(20)
});
parent.add(label4);
win.add(parent);
return win;
if(Titanium.Network.networkType == Titanium.Network.NETWORK_NONE){
var alertDialog = Titanium.UI.createAlertDialog({
title: 'WARNING!',
message: 'Check your network connection and try again.',
buttonNames: ['OK']
});
alertDialog.show();
}
}
module.exports = ApplicationWindow;