Cordova SDK
The Datafly Signal Cordova plugin wraps the native iOS and Android SDKs for Apache Cordova applications.
Requirements
- Cordova CLI 12+
- iOS 15+ / Android API 21+
Installation
cordova plugin add cordova-plugin-datafly-signalInitialisation
document.addEventListener('deviceready', function() {
Datafly.initialize({
pipelineKey: 'dk_live_abc123',
endpoint: 'https://data.example.com'
});
});Usage
// Track a screen view
Datafly.screen('Home');
// Track a custom event
Datafly.track('add_to_cart', {
item_id: 'SKU-001',
item_name: 'Running Shoes',
price: 79.99,
currency: 'GBP'
});
// Identify a user
Datafly.identify('user-123', {
email: 'jane@example.com',
name: 'Jane Doe'
});
// Associate with a company
Datafly.group('company-456', { name: 'Acme Corp' });
// Set consent
Datafly.setConsent({ analytics: true, marketing: false });
// Force flush
Datafly.flush();
// Logout
Datafly.reset();
// Get anonymous ID
Datafly.getAnonymousId(function(id) {
console.log('Anonymous ID:', id);
});The Cordova plugin bridges to the native Datafly SDKs via CDVPlugin (iOS) and CordovaPlugin (Android). All event processing runs natively.
Configuration
See Configuration for all available options.