Skip to main content

Migration Overview

This page helps you migrate from the SAP Emarsys SDK for Android, iOS, and Web to the SAP Engagement Cloud SDK.

Why Migrate?

The SAP Engagement Cloud SDK is the next-generation SDK for SAP Engagement Cloud, serving all mobile and web touchpoints through a unified integration. The SDK focuses on integration consistency and ease of use, incorporating customer feedback and a redesigned architecture across all platforms. Going forward, all new features will be developed exclusively for this SDK.

The SDK offers several key improvements, including:

  • A redesigned, modern architecture delivering tangible performance gains. For example, in-app messages now appear faster than with the SAP Emarsys SDK.
  • One consistent API across Android, iOS, and Web, reducing integration complexity and enabling faster time-to-value.
  • Fewer setup steps and an improved developer experience reduce the potential for errors and accelerate onboarding.
  • Decoupled initialization and setup, allowing tracking to be enabled and disabled independently at any time while the app is running.
  • First-party data collection on Web, avoiding the limitations of third-party cookies and ad blockers. This enables richer behavioral data collection for more accurate personalization across all channels.

Core Architectural Shifts

AreaSAP Emarsys SDKs (Android / iOS / Web)SAP Engagement Cloud SDK
InitializationNative: Emarsys.setup(config); Web: queued loader script (WebEmarsysSdk(...).init) immediately starts trackingTwo-phase: EngagementCloud.initialize() then EngagementCloud.setup.enable(config) when you want data flow
Contact ManagementsetContact, setAuthenticatedContact, clearContact; Web: login, setOpenIdAuthenticatedContact, logoutlink, linkAuthenticated, unlink (uniform)
Push Token / SubscriptionsetPushToken, clearPushToken, getPushToken; Web: subscribe, unsubscribe, isSubscribedregisterToken, clearToken, getToken (Web uses same naming & semantics; subscription state derived from token presence)
In-App Controlpause()/resume()/isPaused; Web did not have in-app messagingpause() / resume() / isPaused (Web: not applicable yet, until WebChannel integration)
Custom EventstrackCustomEvent(name, attrs); Web: customEvent(name, attrs)event.track(CustomEvent(name, attrs))
Deep Link TrackingManual/native handlers; Web: manual link tracking not unifieddeepLink.track(url)
Reactive EventsVarious callbacks & handler interfaces; Web: multiple event listeners (onSubscribe, onUnsubscribe, permission events)Unified reactive stream: EngagementCloud.events (Web exposes same event surface; with a convenient listener registration API)

High-Level Migration Steps

  1. Remove SAP Emarsys SDK dependencies (Gradle / SPM / CocoaPods) and add the SAP Engagement Cloud SDK as a dependency.
  2. Replace the previous Emarsys.setup call with the new, two-phase initialize and enable approach. Call enable only after the user grants marketing consent.
  3. Migrate contact calls — for example, replace setContact with link.
  4. Replace previous setPushToken calls with registerToken calls.
  5. Migrate custom event tracking to use the new CustomEvent model.
  6. Replace deep link tracking with the new API.
  7. (Optional) Migrate to the reactive event streams of the SDK instead of using eventHandlers.

When to Enable Tracking

  1. The SDK initializes automatically. You do NOT need to call initialize() manually.

  2. Call EngagementCloud.setup.enable(config) only after:

  • The user has granted marketing consent.
  • The ApplicationCode is available.
  • You are ready to start tracking events.
info

The enable() call is idempotent and safe to repeat. Repeated calls return an SdkAlreadyEnabledException inside Result.

Error Handling Philosophy

The completion listeners and blocks from the SAP Emarsys SDK have been replaced by suspend (Kotlin) and async (Swift) calls that return Result (Android/KMP) or throw on failure (iOS). On Web, calls return Promises. This approach provides the following benefits:

  • Unified handling of success and failure without custom listener interfaces.
  • Easier composition with coroutines and asynchronous await.
  • Explicit error typing instead of nullable error parameters.

Patterns:

  • Kotlin: EngagementCloud.contact.link(value).onFailure { log(it) } or .getOrThrow() inside try/catch
  • Swift: do { try await EngagementCloud.shared.contact.link(...) } catch { /* handle */ }
  • JS/TS: await window.EngagementCloud.contact.link(...)

Example Code

class MyApp: Application() {
override fun onCreate() {
super.onCreate()
// Later (after user consent or user login)
EngagementCloud.setup.enable(
config = AndroidEngagementCloudSDKConfig(
applicationCode = "ABCDE-12345",
launchActivityClass = MainActivity::class.java
),
onContactLinkingFailed = {
// Prompt user to log in and retrieve their contact identifier
val loggedInUser = showLoginDialogAndAwaitResult()
loggedInUser?.let { LinkContactData(contactFieldValue = it.userId) }
}
)

// Contact linking
EngagementCloud.contact.link(contactFieldValue)

// Custom event
EngagementCloud.event.track(CustomEvent(name, attributes))
}
}

Migrating On Event Actions

The SAP Emarsys SDK's onEventAction handlers are replaced by the reactive EngagementCloud.events stream in the SAP Engagement Cloud SDK. Replace handler registrations with a single collector/subscriber that consumes AppEvent and other event types from the stream.

Known Limitations

info

For more information about known limitations, refer to Known Limitations.

Next Steps

Proceed to Detailed Migration Steps for setup instructions and use API Mapping to migrate feature-specific calls.