diff --git a/docs/data/ampli/integrating-with-ci.md b/docs/data/ampli/integrating-with-ci.md index ebc073199..68bfb5790 100644 --- a/docs/data/ampli/integrating-with-ci.md +++ b/docs/data/ampli/integrating-with-ci.md @@ -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. diff --git a/docs/data/ampli/migration.md b/docs/data/ampli/migration.md index 42e387351..45601c895 100644 --- a/docs/data/ampli/migration.md +++ b/docs/data/ampli/migration.md @@ -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 @@ -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'}); @@ -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 + } + }) @@ -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, diff --git a/docs/data/sdks/android-kotlin/ampli.md b/docs/data/sdks/android-kotlin/ampli.md index 1828fffce..818f9e724 100644 --- a/docs/data/sdks/android-kotlin/ampli.md +++ b/docs/data/sdks/android-kotlin/ampli.md @@ -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) @@ -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) + )) ``` |
Arg
| Description | diff --git a/docs/data/sdks/android-kotlin/index.md b/docs/data/sdks/android-kotlin/index.md index 98005ad6f..901edf9d4 100644 --- a/docs/data/sdks/android-kotlin/index.md +++ b/docs/data/sdks/android-kotlin/index.md @@ -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); @@ -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); @@ -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 ) @@ -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); @@ -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 ) @@ -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 ) @@ -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, @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 ) @@ -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); @@ -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 @@ -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; }); @@ -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 ) @@ -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); @@ -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 ) @@ -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; }); @@ -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 ) @@ -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); @@ -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 ) @@ -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); @@ -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 ) @@ -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); @@ -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 ) @@ -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); @@ -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 ) @@ -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); diff --git a/docs/data/sdks/android/ampli.md b/docs/data/sdks/android/ampli.md index 70fac5360..1b5755a97 100644 --- a/docs/data/sdks/android/ampli.md +++ b/docs/data/sdks/android/ampli.md @@ -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) @@ -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) + )) ``` |
Arg
| Description | diff --git a/docs/data/sdks/android/index.md b/docs/data/sdks/android/index.md index 4a5731bd2..fefff23ae 100644 --- a/docs/data/sdks/android/index.md +++ b/docs/data/sdks/android/index.md @@ -65,7 +65,7 @@ After you've installed the SDK and its dependencies, import Amplitude into any f // initialize AmplitudeClient client = Amplitude.getInstance() - .initialize(getApplicationContext(), "YOUR_API_KEY_HERE") + .initialize(getApplicationContext(), AMPLITUDE_API_KEY) .enableForegroundTracking(getApplication()); // send an event @@ -89,7 +89,7 @@ After you've installed the SDK and its dependencies, import Amplitude into any f // initialize val client = Amplitude.getInstance() - .initialize(getApplicationContext(), "YOUR_API_KEY_HERE") + .initialize(getApplicationContext(), AMPLITUDE_API_KEY) .enableForegroundTracking(application) // send event @@ -122,7 +122,7 @@ Accurate session tracking requires that you enable `enableForegroundTracking(ge ```java AmplitudeClient client = Amplitude.getInstance() - .initialize(getApplicationContext(), "YOUR_API_KEY_HERE") + .initialize(getApplicationContext(), AMPLITUDE_API_KEY) .enableForegroundTracking(getApplication()); ``` @@ -130,7 +130,7 @@ Accurate session tracking requires that you enable `enableForegroundTracking(ge ```kotlin val client = Amplitude.getInstance() - .initialize(getApplicationContext(), "YOUR_API_KEY_HERE") + .initialize(getApplicationContext(), AMPLITUDE_API_KEY) .enableForegroundTracking(application) ``` @@ -1007,7 +1007,6 @@ App set ID is a unique identifier for each app install on a device. App set ID i client.setDeviceId("DEVICE-ID"); ``` - ### Location tracking Amplitude converts the IP of a user event into a location (GeoIP lookup) by default. This information may be overridden by an app's own tracking solution or user data. diff --git a/docs/data/sdks/browser-2/index.md b/docs/data/sdks/browser-2/index.md index 4e5199e0f..2a95a4380 100644 --- a/docs/data/sdks/browser-2/index.md +++ b/docs/data/sdks/browser-2/index.md @@ -31,17 +31,17 @@ Use [this quickstart guide](../sdk-quickstart#browser) to get started with Ampli --8<-- "includes/sdk-ts-browser/init.md" ```ts -// Option 1, initialize with API_KEY only -amplitude.init(API_KEY); +// Option 1, initialize with Amplitude API key only +amplitude.init(AMPLITUDE_API_KEY); // Option 2, initialize with options -amplitude.init(API_KEY, options); +amplitude.init(AMPLITUDE_API_KEY, options); // Option 3, initialize with user ID if it's already known -amplitude.init(API_KEY, 'user@amplitude.com'); +amplitude.init(AMPLITUDE_API_KEY, 'user@amplitude.com'); // Option 4, initialize with a user ID and options -amplitude.init(API_KEY, 'user@amplitude.com', options); +amplitude.init(AMPLITUDE_API_KEY, 'user@amplitude.com', options); ``` ### Configuration @@ -70,7 +70,7 @@ amplitude.init(API_KEY, 'user@amplitude.com', options); --8<-- "includes/sdk-quickstart/quickstart-eu-data-residency.md" ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { serverZone: 'EU', }); ``` @@ -88,7 +88,7 @@ You can control the level of logs printed to the developer console. Set the log level by configuring the `logLevel` with the level you want. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { logLevel: amplitude.Types.LogLevel.Warn, }); ``` @@ -98,7 +98,7 @@ The default logger outputs log to the developer console. You can provide your ow Set the logger by configuring the `loggerProvider` with your own implementation. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { loggerProvider: new MyLogger(), }); ``` @@ -108,7 +108,7 @@ amplitude.init(API_KEY, { Enable the debug mode by setting the `logLevel` to "Debug", for example: ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { logLevel: amplitude.Types.LogLevel.Debug, }); ``` @@ -165,7 +165,7 @@ Starting version 1.9.1, Browser SDK now tracks default events. Browser SDK can b To opt-out, refer to the code below. Otherwise, you can omit the configuration to keep them enabled. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { defaultTracking: { attribution: false, pageViews: false, @@ -179,7 +179,7 @@ amplitude.init(API_KEY, { Alternatively, you can disable Amplitude from tracking all events mentioned above (and future default events) by setting `config.defaultTracking` to `false`. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { defaultTracking: false, }); ``` @@ -194,7 +194,7 @@ Amplitude marketing attribution by default by tracking UTM, referrers and click You can opt out of marketing attribution tracking by setting `config.defaultTracking.attribution` to `false`. Refer to the code sample below. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { defaultTracking: { attribution: false, }, @@ -215,7 +215,7 @@ You can also use advanced configuration for better control of how marketing attr For example, you can configure Amplitude to track marketing attribution separately for each of your subdomains. Refer to the code sample for how to achieve this. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { defaultTracking: { attribution: { excludeReferrers: [location.hostname], @@ -231,7 +231,7 @@ Amplitude tracks page view events by default. The default behavior sends a page You can opt out of page view tracking by setting `config.defaultTracking.pageViews` to `false`. Refer to the code sample below. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { defaultTracking: { pageViews: false, }, @@ -249,7 +249,7 @@ Amplitude tracks session events by default. A session is the period of time a us You can opt out of session tracking by setting `config.defaultTracking.sessions` to `false`. Refer to the code sample below. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { defaultTracking: { sessions: false, }, @@ -272,7 +272,7 @@ Amplitude can track forms that are constructed with `
` tags and `` You can opt out of form interaction tracking by setting `config.defaultTracking.formInteractions` to `false`. Refer to the code sample below. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { defaultTracking: { formInteractions: false, }, @@ -288,7 +288,7 @@ Amplitude tracks file download events by default. A file download event is track You can opt out of tracking file download events by setting `config.defaultTracking.fileDownloads` to `false`. Refer to the code sample below. ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { defaultTracking: { fileDownloads: false, }, @@ -354,7 +354,7 @@ By default, the SDK tracks these properties automatically. You can override this | `platform` | `true` | ```ts -amplitude.init(API_KEY, { +amplitude.init(AMPLITUDE_API_KEY, { trackingOptions: { ipAddress: false, language: false, diff --git a/docs/data/sdks/go/ampli.md b/docs/data/sdks/go/ampli.md index 02c23ea40..f4473850e 100644 --- a/docs/data/sdks/go/ampli.md +++ b/docs/data/sdks/go/ampli.md @@ -43,7 +43,9 @@ Amplitude Data supports tracking analytics events from Go apps. The generated tr import "/ampli" ampli.Instance.Load(ampli.LoadOptions{ - Environment: ampli.EnvironmentProduction, + Client: ampli.LoadClientOptions{ + Configuration: ampli.NewClientConfig(AMPLITUDE_API_KEY), + }, }) ``` @@ -97,7 +99,9 @@ Initialize Ampli in your code. The `Load()` method requires a configuration opti import "/ampli" ampli.Instance.Load(ampli.LoadOptions{ - Environment: ampli.EnvironmentProduction, + Client: ampli.LoadClientOptions{ + Configuration: ampli.NewClientConfig(AMPLITUDE_API_KEY), + }, }) ``` diff --git a/docs/data/sdks/go/index.md b/docs/data/sdks/go/index.md index e0deeedc9..dcdd25f0f 100644 --- a/docs/data/sdks/go/index.md +++ b/docs/data/sdks/go/index.md @@ -59,7 +59,7 @@ import ( func main() { // Create a Config struct - config := amplitude.NewConfig("your-api-key") + config := amplitude.NewConfig(AMPLITUDE_API_KEY) // Events queued in memory will flush when number of events exceed upload threshold // Default value is 200 @@ -356,7 +356,7 @@ func (plugin *addEventIDPlugin) Execute(event *amplitude.Event) *amplitude.Event } func main() { - config := amplitude.NewConfig("your-api-key") + config := amplitude.NewConfig(AMPLITUDE_API_KEY) client := amplitude.NewClient(config) defer client.Shutdown() @@ -426,7 +426,7 @@ func (plugin *myDestinationPlugin) Execute(event *amplitude.Event) { } func main() { - config := amplitude.NewConfig("your-api-key") + config := amplitude.NewConfig(AMPLITUDE_API_KEY) client := amplitude.NewClient(config) defer client.Shutdown() diff --git a/docs/data/sdks/ios-swift/index.md b/docs/data/sdks/ios-swift/index.md index e8edb5c5c..57badd1c8 100644 --- a/docs/data/sdks/ios-swift/index.md +++ b/docs/data/sdks/ios-swift/index.md @@ -29,7 +29,7 @@ You must initialize the SDK before you can instrument. The API key for your Ampl ```swift let amplitude = Amplitude(configuration: Configuration( - apiKey: 'YOUR-API-KEY' + apiKey: AMPLITUDE_API_KEY )) ``` @@ -192,7 +192,7 @@ Every iOS app gets a slice of storage just for itself, meaning that you can read ```swift Amplitude( configuration: Configuration( - apiKey: "YOUR-API-KEY", + apiKey: AMPLITUDE_API_KEY, storageProvider: YourOwnStorage() // YourOwnStorage() should implement Storage ) ) @@ -307,7 +307,7 @@ You can adjust the time window for which sessions are extended. The default sess ```swift let amplitude = Amplitude( configuration: Configuration( - apiKey: "YOUR-API-KEY", + apiKey: AMPLITUDE_API_KEY, minTimeBetweenSessionsMillis: 1000 ) ) @@ -319,7 +319,7 @@ You can also disable those session events. ```swift let amplitude = Amplitude( configuration: Configuration( - apiKey: "YOUR-API-KEY", + apiKey: AMPLITUDE_API_KEY, trackingSessionEvents: false ) ) @@ -330,7 +330,7 @@ You can define your own session expiration time. The default session expiration ```swift let amplitude = Amplitude( configuration: Configuration( - apiKey: "YOUR-API-KEY", + apiKey: AMPLITUDE_API_KEY, minTimeBetweenSessionsMillis: 100000 ) ) @@ -381,7 +381,7 @@ let trackingOptions = TrackingOptions() trackingOptions.disableCity().disableIpAddress().disableLatLng() let amplitude = Amplitude( configuration: Configuration( - apiKey: "YOUR-API-KEY", + apiKey: AMPLITUDE_API_KEY, trackingOptions: trackingOptions ) ) @@ -422,7 +422,7 @@ COPPA (Children's Online Privacy Protection Act) restrictions on IDFA, IDFV, cit ```swift let amplitude = Amplitude( configuration: Configuration( - apiKey: "YOUR-API-KEY", + apiKey: AMPLITUDE_API_KEY, enableCoppaControl: true ) ) @@ -463,7 +463,7 @@ Users may wish to opt out of tracking entirely, which means Amplitude doesn't tr ```swift let amplitude = Amplitude( configuration: Configuration( - apiKey: "YOUR-API-KEY", + apiKey: AMPLITUDE_API_KEY, optOut: true ) ) @@ -502,7 +502,7 @@ class SampleLogger: Logger { let amplitude = Amplitude( configuration: Configuration( - apiKey: "YOUR-API-KEY", + apiKey: AMPLITUDE_API_KEY, loggerProvider: SampleLogger() ) ) diff --git a/docs/data/sdks/ios/ampli.md b/docs/data/sdks/ios/ampli.md index 2dfc8e5bd..0a0d48b84 100644 --- a/docs/data/sdks/ios/ampli.md +++ b/docs/data/sdks/ios/ampli.md @@ -41,7 +41,7 @@ Amplitude Data supports tracking analytics events from iOS apps written in Swift ```swift Ampli.instance.load(LoadOptions( - environment: AmpliEnvironment.Production + client: LoadClientOptions(apiKey: AMPLITUDE_API_KEY) )) ``` @@ -122,7 +122,7 @@ Initialize Ampli in your code. The `load()` method accepts configuration option ```swift Ampli.instance.load(LoadOptions( - environment: AmpliEnvironment.Production + client: LoadClientOptions(apiKey: AMPLITUDE_API_KEY) )); ``` === "Objective-C" @@ -130,7 +130,7 @@ Initialize Ampli in your code. The `load()` method accepts configuration option ```objectivec #import "Ampli.h" [Ampli.instance load:[LoadOptions builderBlock:^(LoadOptionsBuilder *b) { - b.environment = development; + b.apiKey = AMPLITUDE_API_KEY; }]]; ``` diff --git a/docs/data/sdks/java/ampli.md b/docs/data/sdks/java/ampli.md index a5e351d2d..7fe1ac77a 100644 --- a/docs/data/sdks/java/ampli.md +++ b/docs/data/sdks/java/ampli.md @@ -42,9 +42,9 @@ Amplitude Data supports tracking analytics events from JRE programs written in J ```java import com.amplitude.ampli.*; - - Ampli.getInstance().load( - new LoadOptions().setEnvironment(Ampli.Environment.PRODUCTION) + + Ampli.getInstance().load(new LoadOptions() + .setClient(new LoadClientOptions().setApiKey(AMPLITUDE_API_KEY)) ); ``` @@ -123,18 +123,18 @@ Initialize Ampli in your code. The `load()` method accepts configuration option import com.amplitude.ampli.*; Ampli.getInstance().load(new LoadOptions() - .setEnvironment(Ampli.Environment.PRODUCTION) + .setClient(new LoadClientOptions().setApiKey(AMPLITUDE_API_KEY)) ); ``` === "Kotlin" - ```java + ```kotlin import com.amplitude.ampli.* ampli.load(LoadOptions( - environment = Ampli.Environment.PRODUCTION - )); + client = LoadClientOptions(apiKey = AMPLITUDE_API_KEY) + )) ``` |
Arg
| Description | diff --git a/docs/data/sdks/java/index.md b/docs/data/sdks/java/index.md index 03c269c89..43acf3516 100644 --- a/docs/data/sdks/java/index.md +++ b/docs/data/sdks/java/index.md @@ -36,14 +36,14 @@ You must initialize the SDK before any events are instrumented. The API key for ```java Amplitude client = Amplitude.getInstance(); -client.init("YOUR_API_KEY"); +client.init(AMPLITUDE_API_KEY); ``` `Amplitude.getInstance(String name)` may optionally take a name which uniquely holds settings. ```java Amplitude client = Amplitude.getInstance("YOUR_INSTANCE_NAME"); -client.init("YOUR_API_KEY"); +client.init(AMPLITUDE_API_KEY); ``` ### Configuration diff --git a/docs/data/sdks/javascript/ampli.md b/docs/data/sdks/javascript/ampli.md index b7ce41e07..54e9dbd9e 100644 --- a/docs/data/sdks/javascript/ampli.md +++ b/docs/data/sdks/javascript/ampli.md @@ -47,7 +47,7 @@ Amplitude Data supports tracking analytics events from Node.js apps written in J ```js import { ampli } from './src/ampli'; - ampli.load({ environment: 'production' }); + ampli.load({ client: { apiKey: AMPLITUDE_API_KEY } }); ``` 5. [Identify users and set user properties](#identify) diff --git a/docs/data/sdks/javascript/index.md b/docs/data/sdks/javascript/index.md index 01ad74fad..bc77d8ead 100644 --- a/docs/data/sdks/javascript/index.md +++ b/docs/data/sdks/javascript/index.md @@ -27,7 +27,7 @@ Install the Amplitude Analytics JavaScript SDK in your project. === "Snippet" You can install the JavaScript SDK using a small snippet of code that you paste on your site to asynchronously load the SDK. - On every page that you want to install Amplitude analytics, paste the code snippet just before the `` tag, replacing `API_KEY` with your project's API key. + On every page that you want to install Amplitude analytics, paste the code snippet just before the `` tag, replacing `AMPLITUDE_API_KEY` with your project's API key. You can find your project's API Key in your project's [Settings page](https://help.amplitude.com/hc/en-us/articles/360058073772). ```html @@ -60,7 +60,7 @@ Install the Amplitude Analytics JavaScript SDK in your project. !Object.prototype.hasOwnProperty.call(n._iq,e)){n._iq[e]={_q:[]};v(n._iq[e])} return n._iq[e]};e.amplitude=n})(window,document); - amplitude.getInstance().init("API_KEY"); + amplitude.getInstance().init(AMPLITUDE_API_KEY); ``` @@ -89,7 +89,7 @@ import amplitude from 'amplitude-js'; ```js // initialize the client - var instance1 = amplitude.getInstance().init("API_KEY"); + var instance1 = amplitude.getInstance().init(AMPLITUDE_API_KEY); ``` ```js // send an event @@ -109,8 +109,8 @@ Before you can instrument, you must initialize the SDK using the API key for you Initialization creates a default instance, but you can create more instances using `getInstance` with a string name. ```js -var instance1 = amplitude.getInstance().init("API_KEY"); // initializes default instance of Amplitude client -var instance2 = amplitude.getInstance("instance-name").init("API_KEY"); // initializes named instance of Amplitude client +var instance1 = amplitude.getInstance().init("AMPLITUDE_API_KEY"); // initializes default instance of Amplitude client +var instance2 = amplitude.getInstance("instance-name").init("AMPLITUDE_API_KEY"); // initializes named instance of Amplitude client ``` #### Initialization with options @@ -119,7 +119,7 @@ Pass custom options in the `init` method. See a [list of options](https://github ```js var options = {}; -var instance = amplitude.getInstance("instance").init("API_KEY", null, options); // initializes with the given options +var instance = amplitude.getInstance("instance").init(AMPLITUDE_API_KEY, null, options); // initializes with the given options ``` ### Configuration @@ -220,7 +220,7 @@ Set `userID` when initializing the client, or after initialization with the `set ```js var userId = "12345"; - amplitude.getInstance().init("API_KEY", userId); // initializes client with the given userId + amplitude.getInstance().init(AMPLITUDE_API_KEY, userId); // initializes client with the given userId ``` === "Set `userID` with `setUserId`" @@ -478,7 +478,7 @@ amplitude.getInstance().setUserId('USER_ID'); You can also add the User ID as an argument to the init call. ```js -amplitude.getInstance().init('API_KEY', 'USER_ID'); +amplitude.getInstance().init(AMPLITUDE_API_KEY, 'USER_ID'); ``` Don't assign users a user ID that could change, because each unique user ID represents a unique user in Amplitude. For more information see @@ -512,7 +512,7 @@ const sessionId = amplitude.getInstance().getSessionId(); If you are using a [domain proxy](https://developers.amplitude.com/docs/domain-proxies) that requires custom HTTP request headers, configure them with `options.headers` during initialization. ```js -amplitude.getInstance().init(APIKEY, null, { +amplitude.getInstance().init(AMPLITUDE_API_KEY, null, { headers: { 'x-session-id': appToken, 'Content-Type': 'application/json;charset=utf-8' @@ -749,7 +749,7 @@ var deviceId = amplitude.getInstance().getDeviceId() // existing device ID Configure Amplitude by passing an object as the third argument to the init: ```js -amplitude.getInstance().init("API_KEY", null, { +amplitude.getInstance().init(AMPLITUDE_API_KEY, null, { // optional configuration options saveEvents: true, includeUtm: true, @@ -805,7 +805,7 @@ If you are using RequireJS to load your JavaScript files, then you can use it to