What an SDK is for

A software development kit is a ready package for a developer: libraries, code samples,
documentation and utilities that turn integrating an external service from write it from scratch
into add a dependency.

In mobile development an SDK is the standard way to connect a third-party platform. Analytics,
messaging and personalization SDKs all work the same way: the developer adds the dependency,
initialises the SDK with an API key and calls the methods.

The structure of an e-commerce SDK

// iOS: initialisation
GravityField.initialize(apiKey: "your_key", userId: user.id)

// Tracking an event
GravityField.track(.viewItem(itemId: "SKU-1234", category: "sneakers"))

// Fetching recommendations
GravityField.getRecommendations(widgetId: "pdp-similar") { items in
    self.renderRecommendations(items)
}

An SDK usually contains:

Component Purpose
Core library HTTP client, storage, event queue
Tracking module Collecting and batching behavioural events
Content module Fetching personalized content
Push module Handling push tokens and notifications

SDK, snippet or server-side

The integration method follows from the platform:

  • A JS snippet — for websites: asynchronous loading in the browser, a few lines of code.
  • A mobile SDK — for native iOS and Android apps: deeper OS integration, access to push, native
    storage and geolocation.
  • Server-side — for any backend: REST calls or a server SDK, the best performance, no content
    flicker.

E-commerce companies with both a site and an app normally run two: a JS snippet on the web and a
mobile SDK on the app.

What to check before integrating

  • Bundle size: the SDK should not materially change the app’s weight. 0.5–2 MB is acceptable;
    above 5 MB deserves a question about what is inside.
  • Asynchrony: every network call must be off the main thread. An SDK that blocks the UI is a
    stability risk.
  • Event batching: a good SDK accumulates events locally and sends them in batches rather than
    one request per event.
  • OS version support: confirm the SDK covers the minimum OS version your app supports.