Introducing Ampli SDK

  • 17 February 2022
  • 1 reply
  • 278 views

Userlevel 2
Badge +1

The Ampli CLI, Ampli SDK, and Amplitude SDK work together to bring a tracking library into your project.

Developers use a Tracking Plan in the form of a type-safe autogenerated code.
Iteratively can generate a tracking library for all popular platforms and programming languages. The autogenerated library, the Ampli SDK, is a lightweight wrapper over the Amplitude SDK that provides type-safety, supports linting, and enables features like input validation. The code replicates the spec in the Tracking Plan and enforces its rules and requirements.

 

:::note
Visit the ampli-examples GitHub repo for example applications that use the Ampli SDK.
:::

 

Ampli CLI

 

The Ampli CLI is how you download the Ampli SDK for your current tracking plan ampli pull.

Verify implementation status of event tracking in your project by using ampli status.

 

Ampli SDK

 

The Ampli SDK is a dynamic, code-generated SDK. It contains strong types for the events in your tracking plan, and provides autocomplete and static type checking.

ampli.songPlayed({ title: ‘Song #1’ })

The Ampli SDK is a light wrapper for untyped Amplitude SDKs. Once a source with Ampli runtime is setup, more detailed instructions are available from the Implementation page of your Iteratively workspace.

 

Amplitude SDK

The Amplitude SDK is a static, open source SDK with untyped events.

amplitude.logEvent({ event_type: ‘Song Played’, event_properties: { title: ‘Song #1’ }}) 

The Ampli SDK runs on top of the Amplitude SDK. The client.instance is the Amplitude SDK client that makes the underlying calls to Amplitude. If you don’t specify a client.instance, Ampli uses a default instance.

class Ampli {
var client: AmplitudeClient;

load(options) {
// use provided AmplitudeCLient if available, default otherwise
this.client = options.client.instance || Amplitude.getInstance().init(...);
}

// track method wraps Amplitude SDK's logEvent()
track(event: Event) {
// use the Amplitude client to logEvents to the server
this.client.logEvent(event.eventType, event.eventProperties);
}

// strongly typed event method wraps "generic" track
myEvent(properties: EventProperties) {
this.track(new MyEvent(properties));
}
}

You can override the default client configuration with client.config.

 

All (Itly) runtimes will be deprecated. If you are still using an (Itly) runtime, it is better to upgrade to newest Ampli runtime for better experience.

 

Please contact your CSM if you are interested in using Iteratively or Ampli SDK!


1 reply

Userlevel 2
Badge +1

More Ampli SDK docs are available now! Check it out at here!

Reply