Choose your SDK version below:
- Apptrove SDK → Recommended for all projects (Latest: v2.x.x)
- Trackier SDK → Will be deprecated in August 2026 (Latest legacy: v1.x.xx)
Use the tabs below for SDK-specific snippets.
Uninstall Tracking through Firebase Analytics
The Apptrove Cordova SDK supports uninstall tracking through Firebase Analytics, a feature that monitors when users remove your app from their devices, providing valuable insights into user retention, campaign quality, and potential fraud detection. By integrating with Firebase Analytics and a Firebase Cloud Function, this feature tracks uninstall events on Android using the app_remove event, enabling you to analyze churn rates and optimize marketing strategies. This section outlines how to configure uninstall tracking in your Cordova or Ionic Native application.
For Firebase Cloud Messaging-based uninstall tracking, see Through Cloud FCM.
Prerequisites
- Apptrove Cordova SDK installed and initialized in your project (Apptrove recommended)
- Apptrove account with access to the Apptrove Panel
- Firebase project set up with Firebase Analytics enabled for your Android app
- Firebase Cloud Functions configured in your Firebase project
- Cordova 9.0 or later
- For Ionic Native apps:
- Ionic CLI and Capacitor
@awesome-cordova-plugins/coreinstalled (Trackier legacy only:trackierplugin configured)
- Basic knowledge of JavaScript, TypeScript, Angular (for Ionic Native), Firebase Analytics, and Cordova development
Configure Uninstall Tracking
Uninstall tracking requires setting a common identifier (ct_objectId) using the SDK ID (Apptrove: getAppTroveId, Trackier legacy: getTrackierId), configuring Firebase Analytics to track the app_remove event, and setting up a Firebase Cloud Function to send uninstall data to Apptrove.
Steps to Configure Uninstall Tracking
- Initialize the Apptrove SDK with your SDK key and environment.
- Retrieve the SDK ID and set it as a user property (
ct_objectId) in Firebase Analytics (Apptrove:apptroveCordovaPlugin.getAppTroveId, Trackier legacy:trackierCordovaPlugin.getTrackierId). - Configure Firebase Analytics to track the
app_removeevent as a conversion event. - Set up a Firebase Cloud Function to send uninstall data to the Apptrove, following Apptrove support documentation.
TypeScript Example (Ionic Native)
- ✓ Apptrove SDK (Recommended)
- Trackier SDK (Deprecating August 2026)
import { NgModule } from '@angular/core';
import { AppTroveCordovaPlugin, AppTroveConfig, AppTroveEnvironment } from 'com.apptrove.cordova_sdk/ionic-native/apptrove/ngx';
import { FirebaseAnalyticsService } from './services/firebase-analytics.service';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot()],
providers: [AppTroveCordovaPlugin],
bootstrap: [AppComponent],
})
export class AppModule {
constructor(
private apptroveCordovaPlugin: AppTroveCordovaPlugin,
private firebaseAnalytics: FirebaseAnalyticsService
) {
this.initializeAppTroveSDK();
}
private initializeAppTroveSDK() {
const key = "your-sdk-key-here";
const appTroveConfig = new AppTroveConfig(key, AppTroveEnvironment.Development);
this.apptroveCordovaPlugin.initializeSDK(appTroveConfig).then(() => {
console.log("AppTrove SDK initialized successfully.");
// Set AppTrove ID as Firebase User Property for uninstall tracking
this.apptroveCordovaPlugin.getAppTroveId()
.then(val => this.firebaseAnalytics.setUserProperty("ct_objectId", val))
.catch(e => console.log('error: ', e));
}).catch((error) => {
console.error("Error initializing AppTrove SDK:", error);
});
}
}
import { NgModule } from '@angular/core';
import { TrackierCordovaPlugin, TrackierConfig, TrackierEnvironment } from '@awesome-cordova-plugins/trackier/ngx';
import { FirebaseAnalyticsService } from './services/firebase-analytics.service';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot()],
providers: [TrackierCordovaPlugin],
bootstrap: [AppComponent],
})
export class AppModule {
constructor(
private trackierCordovaPlugin: TrackierCordovaPlugin,
private firebaseAnalytics: FirebaseAnalyticsService
) {
this.initializeTrackierSDK();
}
private initializeTrackierSDK() {
const key = "your-sdk-key-here";
const trackierConfig = new TrackierConfig(key, TrackierEnvironment.Development);
this.trackierCordovaPlugin.initializeSDK(trackierConfig).then(() => {
console.log("Trackier SDK initialized successfully.");
// Set Trackier ID as Firebase User Property for uninstall tracking
this.trackierCordovaPlugin.getTrackierId()
.then(val => this.firebaseAnalytics.setUserProperty("ct_objectId", val))
.catch(e => console.log('error: ', e));
}).catch((error) => {
console.error("Error initializing Trackier SDK:", error);
});
}
}
Firebase Analytics Service
import { Injectable } from '@angular/core';
declare var window: any;
@Injectable({
providedIn: 'root'
})
export class FirebaseAnalyticsService {
async setUserProperty(name: string, value: string): Promise<void> {
try {
if (window.FirebaseAnalytics) {
await window.FirebaseAnalytics.setUserProperty({ name, value });
console.log(`Firebase Analytics: Set user property ${name} = ${value}`);
} else {
console.warn('Firebase Analytics not available');
}
} catch (error) {
console.error('Error setting Firebase user property:', error);
}
}
}
JavaScript Example (Pure Cordova)
- ✓ Apptrove SDK (Recommended)
- Trackier SDK (Deprecating August 2026)
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
// Initialize SDK
const key = "your-sdk-key-here";
const appTroveConfig = new AppTroveConfig(key, AppTroveEnvironment.Development);
AppTroveCordovaPlugin.initializeSDK(appTroveConfig).then(() => {
console.log("AppTrove SDK initialized successfully.");
// Set AppTrove ID as Firebase User Property for uninstall tracking
AppTroveCordovaPlugin.getAppTroveId()
.then(val => {
if (window.FirebaseAnalytics) {
window.FirebaseAnalytics.setUserProperty({ name: "ct_objectId", value: val });
console.log(`Firebase Analytics: Set user property ct_objectId = ${val}`);
}
})
.catch(e => console.log('error: ', e));
}).catch((error) => {
console.error("Error initializing AppTrove SDK:", error);
});
}
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
// Initialize SDK
const key = "your-sdk-key-here";
const trackierConfig = new TrackierConfig(key, TrackierEnvironment.Development);
TrackierCordovaPlugin.initializeSDK(trackierConfig).then(() => {
console.log("Trackier SDK initialized successfully.");
// Set Trackier ID as Firebase User Property for uninstall tracking
TrackierCordovaPlugin.getTrackierId()
.then(val => {
if (window.FirebaseAnalytics) {
window.FirebaseAnalytics.setUserProperty({ name: "ct_objectId", value: val });
console.log(`Firebase Analytics: Set user property ct_objectId = ${val}`);
}
})
.catch(e => console.log('error: ', e));
}).catch((error) => {
console.error("Error initializing Trackier SDK:", error);
});
}
Step 2: Configure Firebase Analytics
- Log in to your Firebase Console.
- Navigate to Analytics > Events.
- Ensure the
app_removeevent is marked as a conversion event. - Verify that Firebase Analytics is correctly integrated into your Android app.
Step 3: Set Up Firebase Cloud Function
Prerequisites
- Node.js 20.x or 22.x (use nvm for easy version management)
- Firebase CLI (
npm install -g firebase-tools) - Firebase project on Blaze plan (required for analytics triggers)
- Google account with access to Firebase Console
- App with Firebase Analytics SDK integrated
- Apptrove account (for uninstall event tracking)
Set Up Node.js and Firebase CLI
# Install Node Version Manager (nvm) if not already installed
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# Install and use Node.js 22 (recommended)
nvm install 22
nvm use 22
# Install Firebase CLI globally
npm install -g firebase-tools
# Login to Firebase
firebase login
Create or Select Your Firebase Project
If you already have a Firebase project for your app:
- Go to Firebase Console
- Select your project
If you need to create a new Firebase project:
- In the Firebase Console, click Add project and follow the steps
- Link Google Analytics when prompted
- Register your Android app and download
google-services.jsonfor your app
Initialize Firebase Functions in Your Project Directory
# Create a new directory for your project (if needed)
mkdir YourProjectName
cd YourProjectName
# Initialize Firebase in this directory
firebase init functions
- Choose:
- Use an existing project (if you already have one) or create a new one
- Language: JavaScript
- ESLint: Yes (recommended)
- Install dependencies: Yes
Prepare Your Functions Directory
- Your folder structure should look like this:
YourProjectName/
functions/
index.js
package.json
.eslintrc.js
... - If you already have a
functionsdirectory, use it.
Add the Uninstall Tracking Function Code
Replace the contents of functions/index.js with:
- ✓ Apptrove SDK (Recommended)
- Trackier SDK (Deprecating August 2026)
const functions = require("firebase-functions");
const admin = require("firebase-admin");
const axios = require("axios");
// Set your SDK key here (or use environment variables for security)
const SDK_KEY = "YOUR_SDK_KEY_HERE";
admin.initializeApp();
// Defensive: Only export analytics trigger if available
if (!functions.analytics) {
// This will prevent deployment errors in unsupported environments
console.warn("Analytics triggers are not available in this environment.");
exports.sendAndroidUninstallToTrackierApptrove = () => {};
} else {
exports.sendAndroidUninstallToTrackierApptrove = functions.analytics
.event("app_remove")
.onLog(async (event) => {
// Defensive extraction of user properties
const userProps =
event.user && event.user.userProperties ?
event.user.userProperties :
{};
const installId =
userProps.ct_objectId && userProps.ct_objectId.value ?
userProps.ct_objectId.value :
"";
const mode =
userProps.ct_mode && userProps.ct_mode.value ?
userProps.ct_mode.value :
"production";
const cuid =
userProps.ct_uid && userProps.ct_uid.value ?
userProps.ct_uid.value :
"";
const cmail =
userProps.ct_mail && userProps.ct_mail.value ?
userProps.ct_mail.value :
"";
if (!installId) {
functions.logger.warn(
"No ct_objectId found in event",
{userProps},
);
return null;
}
const url = "https://events.trackier.io/v1/uninstall";
const data = {
installId,
sdkKey: SDK_KEY,
mode,
cuid,
cmail,
meta: event,
};
try {
const response = await axios.post(
url,
data,
{
headers: {"Content-Type": "application/json"},
timeout: 10000,
},
);
functions.logger.log(
"Tracked uninstall",
{
installId,
status: response.status,
data: response.data,
},
);
} catch (error) {
functions.logger.error(
"Uninstall tracking failed",
{
installId,
status: error.response ? error.response.status : "N/A",
data: error.response ? error.response.data : error.message,
},
);
}
return null;
});
}
const functions = require("firebase-functions");
const admin = require("firebase-admin");
const axios = require("axios");
// Set your SDK key here (or use environment variables for security)
const SDK_KEY = "YOUR_SDK_KEY_HERE";
admin.initializeApp();
// Defensive: Only export analytics trigger if available
if (!functions.analytics) {
// This will prevent deployment errors in unsupported environments
console.warn("Analytics triggers are not available in this environment.");
exports.sendAndroidUninstallToTrackierApptrove = () => {};
} else {
exports.sendAndroidUninstallToTrackierApptrove = functions.analytics
.event("app_remove")
.onLog(async (event) => {
// Defensive extraction of user properties
const userProps =
event.user && event.user.userProperties ?
event.user.userProperties :
{};
const installId =
userProps.ct_objectId && userProps.ct_objectId.value ?
userProps.ct_objectId.value :
"";
const mode =
userProps.ct_mode && userProps.ct_mode.value ?
userProps.ct_mode.value :
"production";
const cuid =
userProps.ct_uid && userProps.ct_uid.value ?
userProps.ct_uid.value :
"";
const cmail =
userProps.ct_mail && userProps.ct_mail.value ?
userProps.ct_mail.value :
"";
if (!installId) {
functions.logger.warn(
"No ct_objectId found in event",
{userProps},
);
return null;
}
const url = "https://events.trackier.io/v1/uninstall";
const data = {
installId,
sdkKey: SDK_KEY,
mode,
cuid,
cmail,
meta: event,
};
try {
const response = await axios.post(
url,
data,
{
headers: {"Content-Type": "application/json"},
timeout: 10000,
},
);
functions.logger.log(
"Tracked uninstall",
{
installId,
status: response.status,
data: response.data,
},
);
} catch (error) {
functions.logger.error(
"Uninstall tracking failed",
{
installId,
status: error.response ? error.response.status : "N/A",
data: error.response ? error.response.data : error.message,
},
);
}
return null;
});
}
Set Up Dependencies In package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint:fix": "eslint . --fix",
"lint": "eslint .",
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "20"
},
"main": "index.js",
"dependencies": {
"axios": "^1.10.0",
"firebase-admin": "^11.0.0",
"firebase-functions": "^3.23.0"
},
"devDependencies": {
"eslint": "^8.15.0",
"eslint-config-google": "^0.14.0"
},
"private": true
}
ESLint Configuration
Create a .eslintrc.js file in your functions directory:
// .eslintrc.js
module.exports = {
parserOptions: {
ecmaVersion: 2020, // or at least 2015
sourceType: 'module', // if you're using ES modules (import/export)
},
env: {
es6: true,
node: true, // if you're in a Node.js environment
},
};
Deploy Your Function And Fix link Error
# In the functions directory
cd functions
# Install dependencies
npm install
# (Optional) Run linter and auto-fix issues
npm run lint:fix
firebase deploy --only functions
- If you see errors about CPU/Gen 2 or function already existing as 2nd Gen:
firebase functions:delete sendAndroidUninstallToTrackierApptrove --force
// After delete your function redeploy the function
firebase deploy --only functions - Ignore warnings about outdated
firebase-functionsif you need analytics triggers.
Verify and Debug
A. See Data in Firebase Console
- Go to Firebase Console
- Select your project
- Navigate to Analytics > Dashboard and look for the
app_removeevent
B. Use Analytics DebugView
- In the Firebase Console, go to Analytics > DebugView
- Enable DebugView on your device:
adb shell setprop debug.firebase.analytics.app <your.app.package>
# Example:
adb shell setprop debug.firebase.analytics.app com.example.myapp
# To turn off:
adb shell setprop debug.firebase.analytics.app .none. - Open your app and trigger uninstall or other events
- Watch for real-time events in DebugView
C. Check Cloud Function Logs
- In Firebase Console: Build > Functions > View logs
- monitor the status of your cloud function here:
https://console.cloud.google.com/functions/list

- Look for logs like
Tracked uninstallorUninstall tracking failed
D. Check Trackier Uninstall Log
- Log in to your [Apptrove dashboard]
- Navigate to uninstall/event logs
- Filter by
installIdor other user properties - Confirm the uninstall event was received
![]()
Tips for cloud function
- Analytics triggers not working?
- Make sure you are on Blaze plan and Analytics is linked
- Only deploy to production (not emulator)
- Use
firebase-functions@3.xandfirebase-admin@11.x
- CPU/Gen 2 errors?
- Remove any
"cpu"option fromfirebase.jsonor CLI flags - Delete the function if it was previously deployed as Gen 2, then redeploy
- Remove any
- Dependency conflicts?
- Downgrade
firebase-adminto^11.0.0if needed
- Downgrade
- Linting errors?
- Use
npm run lint:fixand break up long lines/fix indentation
- Use
- Function not triggering?
- Ensure your app is setting the user property:
await analytics().setUserProperty('ct_objectId', trackierId); - Use Analytics DebugView to verify the event is sent
- Ensure your app is setting the user property:
- Still stuck?
Expected Outcome
When a user uninstalls the app, the app_remove event will be logged in Firebase Analytics, and the Firebase Cloud Function will send the ct_objectId to the Apptrove. Uninstall data will appear in the Apptrove Panel, allowing analysis of churn rates and campaign quality.
Best Practices
- Verify Firebase Integration: Ensure Firebase Analytics is correctly set up in your app and the
app_removeevent is enabled as a conversion event. - Test in Development Environment: Use a development/testing environment (Apptrove:
AppTroveEnvironment.*, Trackier legacy:TrackierEnvironment.*) to test uninstall tracking without affecting production data. - Secure Cloud Function: Restrict access to your Firebase Cloud Function to prevent unauthorized data transmission.
- Monitor Uninstall Data: Regularly check the Apptrove Panel to analyze uninstall trends and identify high-churn campaigns.
- Handle Errors Gracefully: Implement error handling for the SDK ID method (Apptrove:
getAppTroveId, Trackier legacy:getTrackierId) to manage cases where the ID is unavailable. - Comply with Privacy Regulations: Ensure uninstall tracking complies with GDPR, CCPA, and other privacy laws, obtaining user consent for analytics where required.
Troubleshooting
- Uninstall Events Not Appearing in Apptrove Panel:
- Verify that the SDK ID method (Apptrove:
getAppTroveId, Trackier legacy:getTrackierId) returns a valid ID and is set as thect_objectIduser property in Firebase Analytics. - Ensure the
app_removeevent is marked as a conversion event in Firebase. - Check the Firebase Cloud Function logs for errors in sending data.
- Verify that the SDK ID method (Apptrove:
- Firebase Analytics Not Tracking
app_remove:- Confirm Firebase Analytics is correctly integrated into your Android app.
- Test the app on a physical device, as emulators may not trigger uninstall events.
- SDK ID Not Set:
- Ensure the SDK is initialized before calling the ID method.
- Check console logs for errors related to
getAppTroveId/getTrackierId.
- Ionic Native Issues:
- Verify the correct provider (
AppTroveCordovaPlugin/TrackierCordovaPlugin) andFirebaseAnalyticsproviders are registered inapp.module.ts. - Run
ionic cap syncand verify the import path matches your SDK (com.apptrove.cordova_sdk/ionic-native/apptrove/ngxfor Apptrove,@awesome-cordova-plugins/trackier/ngxfor Trackier legacy).
- Verify the correct provider (
For further assistance, refer to the Apptrove Documentation Portal or contact Apptrove support at support@apptrove.com.