The Browser SDK sends events to Amplitude. For more information, see the Browser SDK 2 documentation for more configuration options and advanced topics.
This package is also distributed through a CDN. Copy and paste this script in your HTML file. For the latest script loader, visit Amplitude's GitHub repository.
npm install @amplitude/analytics-browser
Import Amplitude into your project:
import * as amplitude from '@amplitude/analytics-browser';
yarn add @amplitude/analytics-browser
Import Amplitude into your project:
import * as amplitude from '@amplitude/analytics-browser';
Install the dependency using NPM, YARN, or script loader.
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
amplitude.init(AMPLITUDE_API_KEY);
Next, send data from your app or website to Amplitude.
const eventProperties = { buttonColor: 'primary',};amplitude.track('Button Clicked', eventProperties);
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
amplitude.init(AMPLITUDE_API_KEY, 'user@amplitude.com');const eventProperties = { buttonColor: 'primary',}; const identifyObj = new Identify();identifyObj.set('location', 'LAX');amplitude.identify(identifyObj); amplitude.track('Button Clicked', eventProperties);
For more information, see Browser SDK 2.
The Ampli CLI, Ampli Wrapper, and Amplitude SDK work together to generate a tracking library based on your Tracking Plan. The autogenerated library provides type safety, supports linting, and enable features like input validation which contextualizes your analytics instrumentation, and reduces instrumentation mistakes.
For more information, see Ampli for Browser SDK 2.0 or examples on GitHub for:
import { ampli } from './ampli';ampli.load({ client: { apiKey: AMPLITUDE_API_KEY } }); ampli.buttonClicked({ buttonColor: 'primary',});
The Node SDK sends events to Amplitude. For more information, see the Node SDK documentation for more configuration options and advanced topics.
npm install @amplitude/analytics-node
yarn add @amplitude/analytics-node
Install the dependency with npm or yarn.
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
import { init } from '@amplitude/analytics-node'; init(AMPLITUDE_API_KEY);
import { init } from '@amplitude/analytics-node'; init(AMPLITUDE_API_KEY);
Next, send data from your app or website to Amplitude.
import { track } from '@amplitude/analytics-node'; const eventProperties = { buttonColor: 'primary',}; track('Button Clicked', eventProperties, { user_id: 'user@amplitude.com',});
import { track } from '@amplitude/analytics-node'; const eventProperties = { buttonColor: 'primary',}; track('Button Clicked', eventProperties, { user_id: 'user@amplitude.com',});
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
import { init, identify, Identify, track } from '@amplitude/analytics-node';init(AMPLITUDE_API_KEY); const identifyObj = new Identify();identify(identifyObj, { user_id: 'user@amplitude.com',}); const eventProperties = { buttonColor: 'primary',};track('Button Clicked', eventProperties, { user_id: 'user@amplitude.com',});
import { init, identify, Identify, track } from '@amplitude/analytics-node';init(AMPLITUDE_API_KEY); const identifyObj = new Identify();identify(identifyObj, { user_id: 'user@amplitude.com',}); const eventProperties = { buttonColor: 'primary',};track('Button Clicked', eventProperties, { user_id: 'user@amplitude.com',});
For more information, see Node SDK.
The Ampli CLI, Ampli Wrapper, and Amplitude SDK work together to generate a tracking library based on your Tracking Plan. The autogenerated library provides type safety, supports linting, and enable features like input validation which contextualizes your analytics instrumentation, and reduces instrumentation mistakes.
For more information, see Ampli for Node SDK or examples on GitHub for:
ampli.load(); ampli.yourEventType('ampli-user-id', { stringProp: 'Strongly typed property', booleanProp: true,});
ampli.load(); ampli.yourEventType('ampli-user-id', { stringProp: 'Strongly typed property', booleanProp: true,});
The Android SDK sends events to Amplitude. For more information, see the Android-Kotlin SDK documentation for more configuration options and advanced topics.
To get started fast, check out an example Kotlin Android project: To get started fast, check out an example Java Android project: To get started fast, check out an example Kotlin JVM project:
Get started with an example project
Kotlin Android example project
build.gradle
for Module: samples: kotlin-android-app
under Gradle Scripts.samples.kotlin-android-app
.Java Android example project
build.gradle
for Module: samples: java-android-app
under Gradle Scripts.samples.java-android-app
.Kotlin JVM example project
samples/kotlin-jvm-app/main/java/main.kt
and run the file.
dependencies { implementation 'com.amplitude:analytics-android:1.+'}
<dependency> <groupId>com.amplitude</groupId> <artifactId>analytics-android</artifactId> <version>[1.0,2.0)</version></dependency>
After you install the library, add the following to AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
For Android 6.0 (Marshmallow) and higher, explicitly add permission to fetch the device advertising ID.
The SDK internally uses a few Java 8 language APIs through desugaring. Make sure your project either enables desugaring or requires a minimum API level of 16.
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
Amplitude recommends doing the initialization in the Main Activity, which never gets destroyed, or the Application class if you have one. After it's initialized, you can use the Android SDK anywhere in your Android application.
For EU data residency, the project must be set up inside Amplitude EU. Initialize the SDK with the API key from Amplitude EU.
import com.amplitude.android.Amplitude val amplitude = Amplitude( Configuration( apiKey = AMPLITUDE_API_KEY, context = applicationContext ))
Configure the serverZone
property to configure your application to use European data residency.
import com.amplitude.android.Amplitude val amplitude = Amplitude( Configuration( apiKey = AMPLITUDE_API_KEY, context = applicationContext, serverZone = ServerZone.EU ))
import com.amplitude.android.Amplitude; Amplitude amplitude = new Amplitude(new Configuration( apiKey = AMPLITUDE_API_KEY, context = applicationContext));
Configure the serverZone
property to configure your application to use European data residency.
import com.amplitude.android.Amplitude; Amplitude amplitude = new Amplitude(new Configuration( apiKey = AMPLITUDE_API_KEY, context = applicationContext, serverZone = ServerZone.EU ));
Next, send data from your app or website to Amplitude.
Events tracked are buffered locally and flushed every 30 seconds. After calling track() in your app, it may take several seconds for event data to appear in Amplitude.
// Track a basic eventamplitude.track("Button Clicked")// Track events with optional propertiesamplitude.track( "Button Clicked", mapOf("buttonColor" to "primary"))
// Track a basic eventamplitude.track("Button Clicked");// Track events with optional propertiesamplitude.track("Button Clicked", new HashMap() {{ put("buttonColor", "primary");}});
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
package com.amplitude.android.sample import android.os.Bundleimport com.amplitude.core.events.Identifyimport com.amplitude.android.Amplitudeimport com.amplitude.android.Configuration class MainActivity : AppCompatActivity() { private val amplitude = Amplitude( Configuration( apiKey = AMPLITUDE_API_KEY, context = applicationContext ) ); override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val identify = Identify() identify.set("user-platform", "android") amplitude.identify(identify) amplitude.track("test event properties", mapOf("test" to "test event property value")) }}
package com.amplitude.android.sample; import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;import com.amplitude.android.Amplitude;import com.amplitude.core.events.Identify;import java.util.HashMap; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Amplitude amplitude = new Amplitude(new Configuration( apiKey = AMPLITUDE_API_KEY, context = applicationContext )); Identify identify = new Identify().set("user-platform", "android") amplitude.identify(identify); amplitude.track("test event properties", new HashMap() {{ put("test", "test event property value"); }}); }}
For more information, see Android-Kotlin SDK.
The Ampli CLI, Ampli Wrapper, and Amplitude SDK work together to generate a tracking library based on your Tracking Plan. The autogenerated library provides type safety, supports linting, and enable features like input validation which contextualizes your analytics instrumentation, and reduces instrumentation mistakes.
For more information, see Ampli for Android-Kotlin SDK or examples on GitHub for:
ampli.load() ampli.yourEventType( stringProp = "Strongly typed property", booleanProp = true)
Ampli.getInstance().load(); Ampli.getInstance().yourEventType( YourEventType.builder() .stringProp("Strongly typed property") .booleanProp(true) .build());
The iOS SDK sends events to Amplitude. For more information, see the iOS Swift SDK documentation for more configuration options and advanced topics.
Add the dependency to your Podfile
:
pod 'AmplitudeSwift', '~> 1.0'
Run pod install
in the project directory.
File
> Swift Package Manager
> Add Package Dependency
. This opens a dialog that allows you to add a package dependency.https://github.com/amplitude/Amplitude-Swift
in the search bar.Add the following line to your Cartfile
.
github "amplitude/Amplitude-Swift" ~> 1.0
Check out the Carthage docs for more info.
Install the Amplitude Analytics iOS SDK with CocoaPods, Carthage, or Swift Package Manager
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
For EU data residency, the project must be set up inside Amplitude EU. Initialize the SDK with the API key from Amplitude EU.
import AmplitudeSwift let amplitude = Amplitude( configuration: Configuration( apiKey: "YOUR-API-KEY" ))
Configure the serverZone
property to configure your application to use European data residency.
import AmplitudeSwift let amplitude = Amplitude( Configuration( apiKey: "YOUR-API-KEY", serverZone: ServerZone.EU ))
@import AmplitudeSwift; AMPConfiguration* configuration = [AMPConfiguration initWithApiKey:@"YOUR-API-KEY"];Amplitude* amplitude = [Amplitude initWithConfiguration:configuration];
Configure the serverZone
property to configure your application to use European data residency.
@import AmplitudeSwift; AMPConfiguration* configuration = [AMPConfiguration initWithApiKey:@"YOUR-API-KEY"];configuration.serverZone = AMPServerZoneEU; Amplitude* amplitude = [Amplitude initWithConfiguration:configuration];
Next, send data from your app or website to Amplitude.
amplitude.track( eventType: "Button Clicked", eventProperties: ["my event prop key": "my event prop value"])
[amplitude track:@"Button Clicked" eventProperties:@{ @"my event prop key": @"my event prop value"}];
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
import AmplitudeSwift let amplitude = Amplitude( configuration: Configuration( apiKey: "YOUR-API-KEY" )) amplitude.track( eventType: "Button Clicked", eventProperties: ["my event prop key": "my event prop value"])
@import AmplitudeSwift; AMPConfiguration* configuration = [AMPConfiguration initWithApiKey:@"YOUR-API-KEY"];Amplitude* amplitude = [Amplitude initWithConfiguration:configuration]; [amplitude track:@"Button Clicked" eventProperties:@{ @"my event prop key": @"my event prop value"}];
For more information, see iOS Swift SDK.
The Ampli CLI, Ampli Wrapper, and Amplitude SDK work together to generate a tracking library based on your Tracking Plan. The autogenerated library provides type safety, supports linting, and enable features like input validation which contextualizes your analytics instrumentation, and reduces instrumentation mistakes.
For more information, see Ampli for iOS Swift SDK or examples on GitHub for:
The JRE SDK sends events to Amplitude. For more information, see the JRE Java SDK documentation for more configuration options and advanced topics.
If you use Gradle in your project, add the following dependency to build.gradle
, and sync your project with the updated file.
dependencies { implementation 'org.json:json:20201115' implementation 'com.amplitude:java-sdk:1.+'}
Download the latest JAR file then add it to the project's build path. See instructions for your IDE.
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
Import Amplitude into any file that uses it. Amplitude uses the open source JSONObject library to conveniently create JSON key-value objects.
For EU data residency, the project must be set up inside Amplitude EU. Initialize the SDK with the API key from Amplitude EU.
import com.amplitude.Amplitude;import org.json.JSONObject; Amplitude amplitude = Amplitude.getInstance();amplitude.init(AMPLITUDE_API_KEY);
Configure the setServerUrl
property to configure your application to use European data residency.
import com.amplitude.Amplitude;import org.json.JSONObject; Amplitude amplitude = Amplitude.getInstance();amplitude.init(AMPLITUDE_API_KEY);amplitude.setServerUrl("https://api.eu.amplitude.com/2/httpapi"); //[tl !~~]
import com.amplitude.Amplitudeimport org.json.JSONObject val amplitude = Amplitude.getInstance()amplitude.init(AMPLITUDE_API_KEY)
Configure the setServerUrl
property to configure your application to use European data residency.
import com.amplitude.Amplitudeimport org.json.JSONObject val amplitude = Amplitude.getInstance()amplitude.init(AMPLITUDE_API_KEY)amplitude.setServerUrl("https://api.eu.amplitude.com/2/httpapi"); //[tl !~~]
Next, send data from your app or website to Amplitude.
amplitude.logEvent(new Event("Button Clicked", "test_user_id"));
amplitude.logEvent(Event("Button Clicked", "test_user_id"))
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
import com.amplitude.Amplitude;import org.json.JSONObject; Amplitude amplitude = Amplitude.getInstance();amplitude.init(AMPLITUDE_API_KEY); Event event = new Event("Button Clicked", "test_user_id"); JSONObject eventProps = new JSONObject();try { eventProps.put("Hover Time", 10).put("prop_2", "value_2");} catch (JSONException e) { System.err.println("Invalid JSON"); e.printStackTrace();}event.eventProperties = eventProps; amplitude.logEvent(event);
import com.amplitude.Amplitudeimport org.json.JSONObject val amplitude = Amplitude.getInstance()amplitude.init(AMPLITUDE_API_KEY) val eventProps= JSONObject()eventProps.put("Hover Time", 10).put("prop_2", "value_2") val event = Event("Button Clicked", "test_user_id")event.eventProperties = eventProps amplitude.logEvent(event)
For more information, see JRE Java SDK.
The Ampli CLI, Ampli Wrapper, and Amplitude SDK work together to generate a tracking library based on your Tracking Plan. The autogenerated library provides type safety, supports linting, and enable features like input validation which contextualizes your analytics instrumentation, and reduces instrumentation mistakes.
For more information, see Ampli for Java SDK or examples on GitHub for:
Ampli.getInstance().load(); Ampli.getInstance().yourEventType("ampli-user-id", YourEventType.builder("Strongly typed property") .stringProp() .booleanProp(false) .build());
Ampli.getInstance().load() Ampli.getInstance().yourEventType("ampli-user-id", YourEventType( stringProp = "Strongly typed property", booleanProp = false ))
The Python SDK sends events to Amplitude. For more information, see the Python SDK documentation for more configuration options and advanced topics.
Install amplitude-analytics
with pip:
pip install amplitude-analytics
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
from amplitude import Amplitude amplitude = Amplitude(AMPLITUDE_API_KEY)
For EU data residency, the project must be set up inside Amplitude EU. Initialize the SDK with the API key from Amplitude EU.
Configure server_zone
when you initialize the client to send data to Amplitude's EU servers.
from amplitude import Amplitude amplitude = Amplitude(AMPLITUDE_API_KEY)amplitude.configuration.server_zone = 'EU' //[tl! ~~]
Next, send data from your app or website to Amplitude.
from amplitude import BaseEvent amplitude.track( BaseEvent( event_type="type of event", user_id="USER_ID", device_id="DEVICE_ID", event_properties={ "source": "notification" } ))
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
from amplitude import Amplitude, Identify, BaseEvent amplitude = Amplitude("AMPLITUDE_API_KEY") identify_obj=Identify()identify_obj.set("location", "LAX")amplitude.identify(identify_obj) amplitude.track( BaseEvent( event_type="type of event", user_id="USER_ID", device_id="DEVICE_ID", event_properties={ "source": "notification" } )) # Flush the event bufferamplitude.flush() # Shutdown the client, recommend to call before program exitamplitude.shutdown()
For more information, see Python SDK.
The Ampli CLI, Ampli Wrapper, and Amplitude SDK work together to generate a tracking library based on your Tracking Plan. The autogenerated library provides type safety, supports linting, and enable features like input validation which contextualizes your analytics instrumentation, and reduces instrumentation mistakes.
For more information, see Ampli for Python SDK or examples on GitHub for:
ampli.load() ampli.yourEventType( "user_id", YourEventType( stringProp= "Strongly typed property", booleanProp=True ))
The React Native SDK sends events to Amplitude. For more information, see the React Native SDK documentation for more configuration options and advanced topics.
npm install @amplitude/analytics-react-nativenpm install @react-native-async-storage/async-storage
yarn add @amplitude/analytics-react-nativeyarn add @react-native-async-storage/async-storage
expo install @amplitude/analytics-react-nativeexpo install @react-native-async-storage/async-storage
Install the native modules to run the SDK on iOS.
cd iospod install
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
import { init } from '@amplitude/analytics-react-native'; init(AMPLITUDE_API_KEY, 'user@amplitude.com');
import { init } from '@amplitude/analytics-react-native'; init(AMPLITUDE_API_KEY, 'user@amplitude.com');
Next, send data from your app or website to Amplitude.
import { track } from '@amplitude/analytics-react-native'; const eventProperties = { buttonColor: 'primary',};track('Button Clicked', eventProperties);
import { track } from '@amplitude/analytics-react-native'; const eventProperties = { buttonColor: 'primary',};track('Button Clicked', eventProperties);
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
import { init, track, Identify, identify } from '@amplitude/analytics-react-native'; init(AMPLITUDE_API_KEY, 'user@amplitude.com'); const identifyObj = new Identify();identifyObj.set('location', 'LAX');identify(identifyObj); const eventProperties = { buttonColor: 'primary',};track('Button Clicked', eventProperties);
import { init, track, Identify, identify } from '@amplitude/analytics-react-native'; init(AMPLITUDE_API_KEY, 'user@amplitude.com'); const identifyObj = new Identify();identifyObj.set('location', 'LAX');identify(identifyObj); const eventProperties = { buttonColor: 'primary',};track('Button Clicked', eventProperties);
For more information, see React Native SDK.
The Ampli CLI, Ampli Wrapper, and Amplitude SDK work together to generate a tracking library based on your Tracking Plan. The autogenerated library provides type safety, supports linting, and enable features like input validation which contextualizes your analytics instrumentation, and reduces instrumentation mistakes.
For more information, see Ampli for the React Native SDK or examples on GitHub for:
ampli.load(); ampli.yourEventType({ stringProp: 'Strongly typed property',});
ampli.load(); ampli.yourEventType({ stringProp: 'Strongly typed property',});
The Flutter SDK sends events to Amplitude. For more information, see the Flutter SDK 3 documentation for more configuration options and advanced topics.
dependencies: amplitude_flutter: ^3.13.0
For iOS installation, add platform :ios, '10.0'
to your Podfile.
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
import 'package:amplitude_flutter/amplitude.dart'; final Amplitude amplitude = Amplitude.getInstance();amplitude.init(AMPLITUDE_API_KEY);
Next, send data from your app or website to Amplitude.
amplitude.logEvent('BUTTON_CLICKED', {"Hover Time": "100ms"});
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
import 'package:amplitude_flutter/amplitude.dart';import 'package:amplitude_flutter/identify.dart'; class YourClass { Future<void> exampleForAmplitude() async { final Amplitude amplitude = Amplitude.getInstance(); amplitude.init(AMPLITUDE_API_KEY); final Identify identify1 = Identify(); identify1.setOnce('sign_up_date', '2015-08-24'); Amplitude.getInstance().identify(identify1); amplitude.logEvent('MyApp startup', eventProperties: { 'friend_num': 10, 'is_heavy_user': true });}
For more information, see Flutter SDK 3.
The Go SDK sends events to Amplitude. For more information, see the Go SDK documentation for more configuration options and advanced topics.
go get github.com/amplitude/analytics-go
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
import ( "github.com/amplitude/analytics-go/amplitude") config := amplitude.NewConfig(AMPLITUDE_API_KEY) client := amplitude.NewClient(config)
Next, send data from your app or website to Amplitude.
client.Track(amplitude.Event{ EventType: "Button Clicked", EventOptions: amplitude.EventOptions{ UserID: "user-id", DeviceID: "device-id", }, EventProperties: map[string]interface{}{"source": "notification"},})
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
package main import ( "github.com/amplitude/analytics-go/amplitude") func main() { config := amplitude.NewConfig(AMPLITUDE_API_KEY) client := amplitude.NewClient(config) identifyObj := amplitude.Identify{} identifyObj.Set("location", "LAX") client.Identify(identifyObj, amplitude.EventOptions{UserID: "user-id"}) client.Track(amplitude.Event{ EventType: "Button Clicked", EventOptions: amplitude.EventOptions{ UserID: "user-id", DeviceID: "device-id", }, EventProperties: map[string]interface{}{"source": "notification"}, })}
For more information, see Go SDK.
The Ampli CLI, Ampli Wrapper, and Amplitude SDK work together to generate a tracking library based on your Tracking Plan. The autogenerated library provides type safety, supports linting, and enable features like input validation which contextualizes your analytics instrumentation, and reduces instrumentation mistakes.
For more information, see Ampli for Go or examples on GitHub for:
import "<your-module-name>/ampli" ampli.Instance.Load(ampli.LoadOptions{ Client: ampli.LoadClientOptions{ Configuration: ampli.NewClientConfig(AMPLITUDE_API_KEY), },})
The Unity SDK sends events to Amplitude. For more information, see the Unity SDK documentation for more configuration options and advanced topics.
The Amplitude Analytics Unity SDK is a plugin to simplify the integration of Amplitude iOS and Android SDKs into your Unity project. This SDK works with Unity 2019.3.11 and higher.
Window > Package Manager
.Add package from Git URL
.https://github.com/amplitude/unity-plugin.git?path=/Assets
, and then click Add.amplitude-unity.unitypackage
from GitHub releases.amplitude-unity.unitypackage
to import the package into your Unity project.Before you instrument,initialize the SDK using the API Key for your Amplitude project.
Amplitude amplitude = Amplitude.getInstance()amplitude.init("YOUR_API_KEY");
Next, send data from your app or website to Amplitude.
import 'package:amplitude_flutter/amplitude.dart'; amplitude.logEvent('MyApp startup', eventProperties: { 'friend_num': 10, 'is_heavy_user': true});
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
Amplitude amplitude = Amplitude.getInstance();amplitude.init("AMPLITUDE_API_KEY"); amplitude.addUserProperty("oranges", 5);Dictionary<string, object> values = new Dictionary<string, object>();values.Add("Key A", "Value A");amplitude.addUserPropertyDict("user_facts", values); JSONObjecteventProperties=newJSONObject().put("key", "value");Amplitude.getInstance().logEvent("initialize_game", eventProperties);
For more information, see Unity SDK.
The Unreal SDK sends events to Amplitude. For more information, see the Unreal SDK documentation for more configuration options and advanced topics.
The Amplitude Analytics Unreal Engine SDK supports projects targeting iOS, MacOS, or tvOS.
Install the Unreal Engine SDK by downloading the latest version of AmplitudeUnreal.zip
found on the GitHub releases page.
Unzip it into a folder inside your Unreal project's Plugins
directory.
mkdir -p Plugins/AmplitudeUnrealunzip AmplitudeUnreal.zip -d Plugins/AmplitudeUnreal
Before you instrument,initialize the SDK using the API Key for your Amplitude project.
#include "Runtime/Analytics/Analytics/Public/Analytics.h"#include "Runtime/Analytics/Analytics/Public/Interfaces/IAnalyticsProvider.h"
Next, send data from your app or website to Amplitude.
TArray<FAnalyticsEventAttribute> AppendedAttributes;AppendedAttributes.Emplace(TEXT("Test Event Prop key1"), TEXT("Test Event value1"));AppendedAttributes.Emplace(TEXT("Test Event Prop key2"), TEXT("Test Event value2"));FAnalytics::Get().GetDefaultConfiguredProvider()->RecordEvent(TEXT("Game Started"), AppendedAttributes);
After you begin sending data to Amplitude, use one of the debugging tools to check your instrumentation and validate your events.
Here's a complete example of how to use the SDK in your own app.
FAnalytics::Get().GetDefaultConfiguredProvider()->SetLocation(TEXT("Test location"));FAnalytics::Get().GetDefaultConfiguredProvider()->SetGender(TEXT("Test gender"));FAnalytics::Get().GetDefaultConfiguredProvider()->SetAge(TEXT(27)); TArray<FAnalyticsEventAttribute> AppendedAttributes;AppendedAttributes.Emplace(TEXT("Test Event Prop key1"), TEXT("Test Event value1"));AppendedAttributes.Emplace(TEXT("Test Event Prop key2"), TEXT("Test Event value2"));FAnalytics::Get().GetDefaultConfiguredProvider()->RecordEvent(TEXT("Game Started"), AppendedAttributes);
For more information, see Unreal SDK.
July 11th, 2024
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2025 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.