How to Create Custom Integrations

Create custom device mode integrations for unsupported destinations in the Android (Kotlin) and iOS (Swift) SDKs.

This guide shows you how to create custom integration plugins to send events to third-party destinations that are not officially supported by RudderStack.

Overview

Custom integrations let you wrap any third-party SDK and send event data directly to destinations that are not officially supported. You can extend RudderStack’s capabilities by integrating any third-party SDK into your mobile apps.

Key differences from standard integrations

AspectStandard integrationsCustom integrations
MaintenanceMaintained by RudderStackMaintained by you
ConfigurationUses dashboard configurationUses hardcoded or custom configuration
Source configurationReceives destination configuration from the RudderStack dashboardReceives an empty configuration object
UpdatesAutomatic (via RudderStack releases)Manual (updates made by the developer)

Implementation guide

The following example creates an integration plugin called MyCustomIntegrationPlugin that wraps a destination called CustomDestinationSdk. All APIs are implemented for demonstration purposes. Apart from the mandatory APIs (key, create, and getDestinationInstance), you can implement other APIs as needed.

Android (Kotlin)

This section shows you how to create a custom integration plugin for Android (Kotlin).

1. Create the integration plugin

2. Add the plugin to Analytics

iOS (Swift)

This section shows you how to create a custom integration plugin for iOS (Swift).

1. Create the integration plugin

2. Add the plugin to Analytics

info

Important consideration

The pluginType for a custom integration plugin in iOS (Swift) SDK should always be .terminal.

Required and optional methods

This section lists the required and optional methods for custom integration plugins.

Required methods

MethodDescription
keyUnique identifier for your integration
create(destinationConfig)Initializes your destination SDK
getDestinationInstance()Returns the destination SDK instance

Optional methods

MethodDescription
track(payload)Forwards track events to your destination SDK
identify(payload)Forwards identify events to your destination SDK
screen(payload)Forwards screen events to your destination SDK
group(payload)Forwards group events to your destination SDK
alias(payload)Forwards alias events to your destination SDK
flush()Flushes events to your destination SDK (if supported)
reset()Resets user data to your destination SDK (if supported)

Custom integration APIs

Custom integrations support the following device mode integration APIs:

  • onDestinationReady(): Register a callback for when the destination is ready
  • getDestinationInstance(): Access the destination instance directly

See more


Questions? Contact us by Email or on Slack