Skip to main content

rudder-sdk-cordova Alternative for Capacitor

rudder-sdk-cordova alternative for Capacitor: RudderStack identify, track, screen, and flush with @capgo/capacitor-rudderstack and the same Cordova style initialize signature.

Illustration of migrating a Cordova app to Capacitor, used for a RudderStack analytics plugin guide

The practical rudder-sdk-cordova alternative for a Capacitor app is @capgo/capacitor-rudderstack. It keeps the same RudderStack event surface as the Cordova RudderClient module (initialize, identify, track, screen, flush, and related helpers) while routing calls through Capacitor promises instead of cordova.exec. This guide lists verifiable npm facts, install steps, usage, and an API map for your Cordova to Capacitor move.

Why leave rudder-sdk-cordova in Capacitor

rudder-sdk-cordova on npm is version 1.4.0. The registry modified timestamp is 28 August 2026. The source lives at rudderlabs/rudder-sdk-cordova. The JavaScript entry in www/RudderClient.js documents:

  • RudderClient.initialize(writeKey, config, options) as a Promise
  • fire-and-forget identify, group, track, screen, alias, reset, and flush
  • device and identity helpers putDeviceToken, putAdvertisingId, putAnonymousId, and optOut
  • RudderClient.LogLevel constants for native verbosity

Cordova initialize can pass config.factories as an array of companion plugins that call setup() before native init.

In a Capacitor codebase the Cordova plugin still means:

  • cordova plugin add rudder-sdk-cordova plus any per-destination factory packages
  • mixing Cordova exec timing with Capacitor app bootstrap
  • no typed Capacitor import in TypeScript apps

@capgo/capacitor-rudderstack latest on npm is 8.1.19 with a modified date of 12 November 2026. The Capacitor README and src/definitions.ts mirror the Cordova call shapes and document that factories on RudderConfiguration is ignored in the Capacitor port because Cordova factory plugins are not bundled yet. Capgo maintains the wrapper on an open source cadence where a human still reviews, tests and merges 50+ pull requests daily.

Install

bun add @capgo/capacitor-rudderstack
bunx cap sync

Configure your RudderStack write key and data plane URL in application bootstrap code, not in capacitor.config.ts, unless you add your own env layer.

Usage example

import { nativePlugin } from '@capgo/capacitor-rudderstack';

export async function startAnalytics() {
  await nativePlugin.initialize('YOUR_WRITE_KEY', {
    dataPlaneUrl: 'https://your.dataplane.rudderstack.com',
    trackLifecycleEvents: true,
    recordScreenViews: false,
    logLevel: nativePlugin.LogLevel.WARN,
  });

  await nativePlugin.identify('user_123', { email: 'user@example.com', plan: 'pro' });
  await nativePlugin.track('Signed Up', { source: 'mobile' });
  await nativePlugin.screen('Checkout', { step: 'payment' });
}

export async function onAppBackground() {
  await nativePlugin.flush();
}

Push tokens and privacy controls:

await nativePlugin.putDeviceToken(apnsOrFcmToken);
await nativePlugin.optOut(false);

Migrating from Cordova to Capacitor

Cordova code requires RudderClient from the Cordova module and calls initialize before other methods. Capacitor code imports nativePlugin and uses the same ordering.

// Before (Cordova)
const RudderClient = require('rudder-sdk-cordova/www/RudderClient');

await RudderClient.initialize('WRITE_KEY', {
  dataPlaneUrl: 'https://your.dataplane.rudderstack.com',
});
RudderClient.identify('user_123', { plan: 'pro' });
RudderClient.track('Order Completed', { revenue: 42 });
// After (Capacitor)
import { nativePlugin } from '@capgo/capacitor-rudderstack';

await nativePlugin.initialize('WRITE_KEY', {
  dataPlaneUrl: 'https://your.dataplane.rudderstack.com',
});
await nativePlugin.identify('user_123', { plan: 'pro' });
await nativePlugin.track('Order Completed', { revenue: 42 });

API mapping table

rudder-sdk-cordova (RudderClient) @capgo/capacitor-rudderstack (nativePlugin)
initialize(writeKey, config, options) initialize(writeKey, config?, options?)
identify(userId, traits, options) identify(userId, traits?, options?)
group(groupId, groupTraits, options) group(groupId, groupTraits?, options?)
track(eventName, properties, options) track(eventName, properties?, options?)
screen(screenName, properties, options) screen(screenName, properties?, options?)
alias(newId, options) alias(newId, options?)
reset() reset()
flush() flush()
putDeviceToken(token) putDeviceToken(token)
putAdvertisingId(id) / setAdvertisingId putAdvertisingId(id) / setAdvertisingId(id)
putAnonymousId(id) / setAnonymousId putAnonymousId(id) / setAnonymousId(id)
optOut(boolean) optOut(boolean)
RudderClient.LogLevel nativePlugin.LogLevel
config.factories companion plugins Not supported (factories ignored in Capacitor)
Cordova exec (void returns on track) Capacitor await on all calls

If your Cordova app depended on a RudderStack Cordova factory plugin, plan a native destination integration outside this Capacitor wrapper or keep the Cordova factory until Capgo documents support.

Swapping the analytics bridge requires a new store build. Use Capgo Build for binaries, then ship event naming and property changes with Capgo live updates where logic stays in TypeScript. For the full platform move, read the Cordova to Capacitor migration guide.

Live updates for Capacitor apps

When a web-layer bug is live, ship the fix through Capgo instead of waiting days for app store approval. Users get the update in the background while native changes stay in the normal review path.

Latest from our Blog

Capgo gives you the best insights you need to create a truly professional mobile app.