Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
AMP-82205 de-emphasised environments based ampli initialization, and …
Browse files Browse the repository at this point in the history
…recommended to use client.apiKey instead. Normalized AMPLITUDE_API_KEY usage across the docs. (#941)
  • Loading branch information
Andrew Kramarev authored Aug 30, 2023
1 parent 52dba6d commit b0e6fd4
Show file tree
Hide file tree
Showing 31 changed files with 182 additions and 180 deletions.
2 changes: 1 addition & 1 deletion docs/data/ampli/integrating-with-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Use Amplitude Data with your continuous integration (CI) workflow.
template: guide.html
---

Amplitude Data works best when integrated into your continuous integration (CI) workflow, running continuously alongside your test suite. Amplitude Data integrates with all common CI providers and you can configure it for custom environments.
Amplitude Data works best when integrated into your continuous integration (CI) workflow, running continuously alongside your test suite. Amplitude Data integrates with all common CI providers, and you can configure it for custom environments.

After you've added Amplitude Data to your CI environment, Amplitude Data verifies your analytics against every build.

Expand Down
16 changes: 9 additions & 7 deletions docs/data/ampli/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Start by passing your existing Amplitude SDK instance to Ampli. Ampli will use t
ampli.load({ client: { instance: amplitude }})
```

All existing `amplitude.track('Song Played')` (a.k.a `amplitude.logEvent()`) will continue to work. However, you now also have access to strongly typed methods and types for all events for the Source in your tracking plan e.g. `ampli.songPlayed()` and `ampli.track(new SongPlayed())`.
All existing `amplitude.track('Song Played')` (a.k.a. `amplitude.logEvent()`) will continue to work. However, you now also have access to strongly typed methods and types for all events for the Source in your tracking plan e.g. `ampli.songPlayed()` and `ampli.track(new SongPlayed())`.

#### Process

Expand All @@ -64,7 +64,7 @@ import * as amplitude, { BaseEvent } from '@amplitude/analytics-browser';
// Notice this will keep working as-is, so you can keep the
// existing implementation while progressively migrating to Ampli

amplitude.init('API-KEY');
amplitude.init(AMPLITUDE_API_KEY);
amplitude.add(new MyPlugin());
amplitude.setUserId('me');
amplitude.track('Song Played', { title: 'Happy Birthday'});
Expand Down Expand Up @@ -99,10 +99,10 @@ After all existing Amplitude SDK instrumentation has been replaced with Ampli, y

// Initialize
const sdkOptions: Options = { ... };
- amplitude.init('API-KEY', undefined, sdkOptions);
- amplitude.init(AMPLITUDE_API_KEY, undefined, sdkOptions);
+ ampli.load({
+ environment: 'production',
+ client: {
+ apiKey: AMPLITUDE_API_KEY,
+ configuration: sdkOptions
+ }
+ })
Expand Down Expand Up @@ -178,12 +178,14 @@ amplitude.init(AMPLITUDE_API_KEY);
```typescript
import { ampli, SongPlayed } from './ampli';

// Initialize with an Environment from Data
// Initialize with Amplitude API Key
ampli.load({
environment: 'my-production'
client: {
apiKey: AMPLITUDE_API_KEY
}
});

// Initialize with pre-existing Amplitude SDK instance
// Or initialize with pre-existing Amplitude SDK instance
ampli.load({
client: {
instance: amplitude,
Expand Down
14 changes: 7 additions & 7 deletions docs/data/sdks/android-kotlin/ampli.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Amplitude Data supports tracking analytics events from Android apps written in K
import com.amplitude.ampli.*

ampli.load(appContext, LoadOptions(
environment = Ampli.Environment.PRODUCTION
));
client = LoadClientOptions(apiKey = AMPLITUDE_API_KEY)
))
```

5. [Identify users and set user properties](#identify)
Expand Down Expand Up @@ -111,19 +111,19 @@ Initialize Ampli in your code. The `load()` method accepts configuration option
```java
import com.amplitude.ampli.*;

Ampli.getInstance().load(appContext, new LoadOptions()
.setEnvironment(Ampli.Environment.PRODUCTION)
Ampli.getInstance().load(this, new LoadOptions()
.setClient(new LoadClientOptions().setApiKey(AMPLITUDE_API_KEY))
);
```

=== "Kotlin"

```java
```kotlin
import com.amplitude.ampli.*

ampli.load(appContext, LoadOptions(
environment = Ampli.Environment.PRODUCTION
));
client = LoadClientOptions(apiKey = AMPLITUDE_API_KEY)
))
```

| <div class ="big-column">Arg</div> | Description |
Expand Down
58 changes: 29 additions & 29 deletions docs/data/sdks/android-kotlin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Use [this quickstart guide](../../sdks/sdk-quickstart#android) to get started wi
```java
import com.amplitude.android.Amplitude;

Configuration configuration = new Configuration(API_KEY, getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.setFlushIntervalMillis(1000);
configuration.setFlushQueueSize(10);

Expand Down Expand Up @@ -103,7 +103,7 @@ You can dynamically set the configuration after initialization.
```java
import com.amplitude.android.Amplitude;

Configuration configuration = new Configuration(API_KEY, getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
Amplitude amplitude = new Amplitude(configuration);

amplitude.getConfiguration().setOptOut(true);
Expand All @@ -118,7 +118,7 @@ You can dynamically set the configuration after initialization.

val amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
serverZone = ServerZone.EU
)
Expand All @@ -130,7 +130,7 @@ You can dynamically set the configuration after initialization.
```java
import com.amplitude.android.Amplitude;

Configuration configuration = new Configuration("API_KEY", getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.setServerZone(ServerZone.EU);

Amplitude amplitude = new Amplitude(configuration);
Expand Down Expand Up @@ -207,7 +207,7 @@ You can enable Amplitude to start tracking all events mentioned above, use the c
```kotlin
Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions.ALL
)
Expand All @@ -222,7 +222,7 @@ Similarly, you can disable Amplitude to track all events mentioned above with th
```kotlin
Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions.NONE
)
Expand All @@ -234,7 +234,7 @@ You can also customize the tracking with `DefaultTrackingOptions`, see code samp
```kotlin
Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions(
appLifecycles = true,
Expand All @@ -253,7 +253,7 @@ You can enable Amplitude to start tracking session events by setting `configurat
```kotlin
Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions(
sessions = true
Expand All @@ -274,7 +274,7 @@ You can enable Amplitude to start tracking application lifecycle events by setti
```kotlin
Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions(
appLifecycles = true
Expand All @@ -297,7 +297,7 @@ You can enable Amplitude to start tracking screen view events by setting `config
```kotlin
Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions(
screenViews = true
Expand All @@ -315,7 +315,7 @@ You can enable Amplitude to start tracking deep link events by setting `configur
```kotlin
Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions(
deepLinks = true
Expand Down Expand Up @@ -553,7 +553,7 @@ You can adjust the time window for which sessions are extended. The default sess
```kotlin
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
minTimeBetweenSessionsMillis = 10000
)
Expand All @@ -563,7 +563,7 @@ You can adjust the time window for which sessions are extended. The default sess
=== "Java"

```java
Configuration configuration = new Configuration(API_KEY, getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.setMinTimeBetweenSessionsMillis(1000);

Amplitude amplitude = new Amplitude(configuration);
Expand All @@ -577,7 +577,7 @@ You can also disable those session events.
```kotlin
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
defaultTracking = DefaultTrackingOptions(
sessions = false
Expand All @@ -591,7 +591,7 @@ You can also disable those session events.
```
defaultTrackingOptions = new DefaultTrackingOptions();
defaultTrackingOptions.setSessions(false);
amplitude = AmplitudeKt.Amplitude(API_KEY, getApplicationContext(), configuration -> {
amplitude = AmplitudeKt.Amplitude(AMPLITUDE_API_KEY, getApplicationContext(), configuration -> {
configuration.setDefaultTracking(defaultTrackingOptions);
return Unit.INSTANCE;
});
Expand All @@ -618,7 +618,7 @@ You can define your own session expiration time. The default session expiration
```kotlin
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
minTimeBetweenSessionsMillis = 10000
)
Expand All @@ -628,7 +628,7 @@ You can define your own session expiration time. The default session expiration
=== "Java"

```java
Configuration configuration = new Configuration(API_KEY, getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.setMinTimeBetweenSessionsMillis(10000);

Amplitude amplitude = new Amplitude(configuration);
Expand Down Expand Up @@ -720,7 +720,7 @@ Before initializing the SDK with your apiKey, create a `TrackingOptions` insta
trackingOptions.disableCity().disableIpAddress().disableLatLng()
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
trackingOptions = trackingOptions
)
Expand All @@ -734,7 +734,7 @@ Before initializing the SDK with your apiKey, create a `TrackingOptions` insta
trackingOptions.disableCity().disableIpAddress().disableLatLng();

// init instance
amplitude = AmplitudeKt.Amplitude(API_KEY, getApplicationContext(), configuration -> {
amplitude = AmplitudeKt.Amplitude(AMPLITUDE_API_KEY, getApplicationContext(), configuration -> {
configuration.setTrackingOptions(trackingOptions);
return Unit.INSTANCE;
});
Expand Down Expand Up @@ -777,7 +777,7 @@ COPPA (Children's Online Privacy Protection Act) restrictions on IDFA, IDFV, cit
```kotlin
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
enableCoppaControl = true //Disables ADID, city, IP, and location tracking
)
Expand All @@ -787,7 +787,7 @@ COPPA (Children's Online Privacy Protection Act) restrictions on IDFA, IDFV, cit
=== "Java"

```java
Configuration configuration = new Configuration(API_KEY, getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
//Disables ADID, city, IP, and location tracking
configuration.setEnableCoppaControl(true);

Expand All @@ -807,7 +807,7 @@ After you set up the logic to fetch the advertising ID, you can enable `useAdver
```kotlin
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
useAdvertisingIdForDeviceId = true
)
Expand All @@ -817,7 +817,7 @@ After you set up the logic to fetch the advertising ID, you can enable `useAdver
=== "Java"

```java
Configuration configuration = new Configuration(API_KEY, getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.setUseAdvertisingIdForDeviceId(true);

Amplitude amplitude = new Amplitude(configuration);
Expand Down Expand Up @@ -845,7 +845,7 @@ App set ID is a unique identifier for each app install on a device. App set ID i
```kotlin
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
useAppSetIdForDeviceId = true
)
Expand All @@ -855,7 +855,7 @@ App set ID is a unique identifier for each app install on a device. App set ID i
=== "Java"

```java
Configuration configuration = new Configuration(API_KEY, getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.setUseAppSetIdForDeviceId(true);
Amplitude amplitude = new Amplitude(configuration);
Expand Down Expand Up @@ -895,7 +895,7 @@ By default, Amplitude can use Android location service (if available) to add the
```kotlin
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
locationListening = true
)
Expand All @@ -905,7 +905,7 @@ By default, Amplitude can use Android location service (if available) to add the
=== "Java"
```java
Configuration configuration = new Configuration("API_KEY", getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.setLocationListening(true);
Amplitude amplitude = new Amplitude(configuration);
Expand All @@ -924,7 +924,7 @@ Users may wish to opt out of tracking entirely, which means Amplitude doesn't tr
```kotlin
amplitude = Amplitude(
Configuration(
apiKey = API_KEY,
apiKey = AMPLITUDE_API_KEY,
context = applicationContext,
optOut = true
)
Expand All @@ -934,7 +934,7 @@ Users may wish to opt out of tracking entirely, which means Amplitude doesn't tr
=== "Java"
```java
Configuration configuration = new Configuration(API_KEY, getApplicationContext());
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.setOptOut(true);
Amplitude amplitude = new Amplitude(configuration);
Expand Down
14 changes: 7 additions & 7 deletions docs/data/sdks/android/ampli.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Amplitude Data supports tracking analytics events from Android apps written in K
import com.amplitude.ampli.*

ampli.load(appContext, LoadOptions(
environment = Ampli.Environment.PRODUCTION
));
client = LoadClientOptions(apiKey = AMPLITUDE_API_KEY)
))
```

5. [Identify users and set user properties](#identify)
Expand Down Expand Up @@ -113,19 +113,19 @@ Initialize Ampli in your code. The `load()` method accepts configuration option
```java
import com.amplitude.ampli.*;

Ampli.getInstance().load(appContext, new LoadOptions()
.setEnvironment(Ampli.Environment.PRODUCTION)
Ampli.getInstance().load(this, new LoadOptions()
.setClient(new LoadClientOptions().setApiKey(AMPLITUDE_API_KEY))
);
```

=== "Kotlin"

```java
```kotlin
import com.amplitude.ampli.*

ampli.load(appContext, LoadOptions(
environment = Ampli.Environment.PRODUCTION
));
client = LoadClientOptions(apiKey = AMPLITUDE_API_KEY)
))
```

| <div class ="big-column">Arg</div> | Description |
Expand Down
Loading

0 comments on commit b0e6fd4

Please sign in to comment.