Skip to content
Use the Firebase Analytics SDK in Axway Titanium 🚀
Branch: master
Clone or download
hansemannn Merge pull request #46 from m1ga/master
add missing import, clang, compile agains 16.1.4
Latest commit 87a3166 May 20, 2019

Firebase Analytics - Titanium Module

Use the native Firebase SDK in Axway Titanium. This repository is part of the Titanium Firebase project.

⚠️ This module already comply to the EU General Data Protection Regulation (GDPR) regulation already. Use the enabled property to enable or disable Analytics and resetAnalyticsData() to make Cambridge Analytica angry 😙.


  • The Firebase Core module
  • iOS: Titanium SDK 6.2.0+
  • Android: Titanium SDK 7.0.0+


In general, make sure to follow the general instructions described in the main project.


No additional setup required for Firebase Analytics on iOS.


There are a few additional requirements for Firebase Analytics on Android:

  1. Copy the following code under the <application> tag of your tiapp.xml. Please note to replace all occurrences of MY_PACKAGE_NAME with your actual package name (= <id> in your tiapp.xml):
<android xmlns:android="">
			<service android:name="" android:enabled="true" android:exported="false" />

			<service android:name="" android:permission="android.permission.BIND_JOB_SERVICE" android:enabled="true" android:exported="false" />

			<service android:name="MY_PACKAGE_NAME.gcm.RegistrationIntentService" android:exported="false" />

			<receiver android:name="" android:enabled="true">
				  <action android:name="" />
			<!-- Only add the GCM-related tags if you are using push notifications as well -->
			<service android:name="MY_PACKAGE_NAME.gcm.GcmIntentService" android:exported="false">
				  <action android:name="" />

			<service android:name="MY_PACKAGE_NAME.gcm.GcmIntentService" android:exported="false">
				  <action android:name="" />

			<service android:name="MY_PACKAGE_NAME.gcm.GcmIDListenerService" android:exported="false">
				  <action android:name="" />
  1. Create a file strings.xml that is located at:

    • Alloy: <project-dir>/app/platform/android/res/values/strings.xml
    • Classic: <project-dir>/platform/android/res/values/strings.xml

    with your Firebase Application ID (mobilesdk_app_id from the JSON file) content:

<?xml version="1.0" encoding="UTF-8"?>
	<string name="google_app_id">YOUR_FIREBASE_APPLICATION_ID</string>





log(name, parameters)
  • name (String)
  • parameters (Dictionary, optional)

Logs an app event. The event can have up to 25 parameters. Events with the same name must have the same parameters. Up to 500 event names are supported.

Make sure to check the Log Events docs to validate that you are using a valid event name (1st parameter) and parameter structure (2nd event).

  • parameters (Dictionary)
    • value (String)
    • name (String)

Sets a user property to a given value. Up to 25 user property names are supported. Once set, user property values persist throughout the app lifecycle and across sessions.

  • parameters (Dictionary)
    • screenName (String)
    • screenClass (String, defaults to TiController)

Sets the current screen name, which specifies the current visual context in your app. This helps identify the areas in your app where users spend their time and how they interact with your app.

resetAnalyticsData() (iOS-only, on Android requires /lib version > 11.6.0)

Clears all analytics data for this app from the device and resets the app instance id.


enabled (Boolean, set)

Sets whether analytics collection is enabled for this app on this device. This setting is persisted across app sessions. By default it is enabled.

appInstanceID (String, get, iOS-only)

Instance ID provides a unique identifier for each app instance and a mechanism to authenticate and authorize actions (for example, sending an FCM message).

userID (String, set, iOS-only)

The user ID to ascribe to the user of this app on this device, which must be non-empty and no more than 256 characters long. Setting userID to nil removes the user ID.


// Require the Firebase Core module (own project!)
var FirebaseCore = require('firebase.core');

// Require the Firebase Analytics module
var FirebaseAnalytics = require('');

// Configure Firebase

// Get the App Instance ID'App Instance ID: ' + FirebaseAnalytics.appInstanceID);

// Log to the Firebase console
FirebaseAnalytics.log('My_Event', { /* Optional arguments */ });

// Set user-property string
  name: 'My_Name',
  value: 'My Value'

// Set User-ID
FirebaseAnalytics.userID = 'MyUserID';

// Set screen-name  and screen-class
  screenName: 'ScreenName',
  screenClass: 'ScreenClass'

// Toogle analytics on/off (default: on / true)
FirebaseAnalytics.enabled = false;

Update SDK's

  • Android: Using Gradle command gradle getDeps
  • iOS: Downloading the latest framework


cd ios
appc run -p [ios|android] --build-only


This module is Copyright (c) 2017-Present by Hans Knöchel. All Rights Reserved.

You can’t perform that action at this time.