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-signal

Initialisation

document.addEventListener('deviceready', function() {
  DataflySignal.initialize({
    pipelineKey: 'dk_live_abc123',
    endpoint: 'https://data.example.com'
  });
});

Usage

// Track a screen view
DataflySignal.screen('Home');
 
// Track a custom event
DataflySignal.track('add_to_cart', {
  item_id: 'SKU-001',
  item_name: 'Running Shoes',
  price: 79.99,
  currency: 'GBP'
});
 
// Identify a user
DataflySignal.identify('user-123', {
  email: '[email protected]',
  name: 'Jane Doe'
});
 
// Associate with a company
DataflySignal.group('company-456', { name: 'Acme Corp' });
 
// Set consent
DataflySignal.setConsent({ analytics: true, marketing: false });
 
// Force flush
DataflySignal.flush();
 
// Logout
DataflySignal.reset();
 
// Get anonymous ID
DataflySignal.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.