Amplitude SDK Quickstart Guide
Use this guide to get started with the Amplitude SDKs. Choose your target platform:
The Browser SDK lets you send events to Amplitude. See the full documentation at Browser SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install dependency¶
Install the dependency using NPM, YARN, or script loader.
npm install @amplitude/analytics-browser
yarn add @amplitude/analytics-browser
<script type="text/javascript">
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[]};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{r.invoked=!0;var n=t.createElement("script");n.type="text/javascript",n.integrity="sha384-XNX6U2ua04l5JNPk8racSkagg14UYkjWQjQmbRhYhLh0rtnEFZ1QTynnf4EUTukV",n.crossOrigin="anonymous",n.async=!0,n.src="https://cdn.amplitude.com/libs/analytics-browser-1.1.1-min.js.gz",n.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var s=t.getElementsByTagName("script")[0];function v(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}}s.parentNode.insertBefore(n,s);for(var o=function(){return this._q=[],this},i=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],a=0;a<i.length;a++)v(o,i[a]);r.Identify=o;for(var u=function(){return this._q=[],this},c=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],l=0;l<c.length;l++)v(u,c[l]);r.Revenue=u;var p=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],d=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];function f(e){function t(t,r){e[t]=function(){var n={promise:new Promise((r=>{e._q.push({name:t,args:Array.prototype.slice.call(arguments,0),resolve:r})}))};if(r)return n}}for(var r=0;r<p.length;r++)t(p[r],!1);for(var n=0;n<d.length;n++)t(d[n],!0)}f(r),e.amplitude=r}}(window,document)}();
</script>
Initialization¶
import { init } from '@amplitude/analytics-browser';
init(AMPLITUDE_API_KEY, 'user@amplitude.com');
import { init } from '@amplitude/analytics-browser';
init(AMPLITUDE_API_KEY, 'user@amplitude.com');
Send data¶
Next, send data from your app or website to Amplitude.
import { track } from '@amplitude/analytics-browser';
const eventProperties = {
buttonColor: 'primary',
};
track('Button Clicked', eventProperties);
import { track } from '@amplitude/analytics-browser';
const eventProperties = {
buttonColor: 'primary',
};
track('Button Clicked', eventProperties);
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Instrument Explorer¶
Download the Google Chrome Extension, which helps you examine and debug your Amplitude Browser SDK.
Learn more about Instrument Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
ampli.load();
ampli.yourEventType({
stringProp: 'Strongly typed property',
booleanProp: true
});
ampli.load();
ampli.yourEventType({
stringProp: 'Strongly typed property',
booleanProp: true
});
Learn more about Ampli Browser.
Complete code example¶
Here's a complete example of how to use the SDK in your own app.
import { init, identify, Identify, track } from '@amplitude/analytics-browser';
init(AMPLITUDE_API_KEY, 'user@amplitude.com');
const eventProperties = {
buttonColor: 'primary',
};
const identifyObj = new Identify();
identifyObj.set('location', 'LAX');
identify(identifyObj);
track('Button Clicked', eventProperties);
import { init, identify, Identify, track } from '@amplitude/analytics-browser';
init(AMPLITUDE_API_KEY, 'user@amplitude.com');
const eventProperties = {
buttonColor: 'primary',
};
const identifyObj = new Identify();
identifyObj.set('location', 'LAX');
identify(identifyObj);
track('Button Clicked', eventProperties);
Learn more available functionalities in Browser SDK.
The Node.js SDK lets you send events to Amplitude. See the full documentation at Node.js SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
Install dependencies using NPM or YARN.
npm install @amplitude/analytics-node
yarn add @amplitude/analytics-node
Initialization¶
import { init } from '@amplitude/analytics-node';
init(AMPLITUDE_API_KEY);
import { init } from '@amplitude/analytics-node';
init(AMPLITUDE_API_KEY);
Send data¶
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',
});
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
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,
});
Learn more about Ampli Node.
Complete code example¶
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',
});
Learn more available functionalities in Node SDK.
The Android SDK lets you send events to Amplitude. See the full documentation at Android SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install dependencies¶
dependencies {
implementation 'com.amplitude:analytics-android:1.+'
}
To report events to Amplitude, add the INTERNET permission to your AndroidManifest.xml file. <uses-permission android:name="android.permission.INTERNET" />
Learn more about Add Android Permission.
Initialization¶
val amplitude = Amplitude(
Configuration(
apiKey = AMPLITUDE_API_KEY,
context = applicationContext
)
)
Amplitude amplitude = new Amplitude(new Configuration(
apiKey = AMPLITUDE_API_KEY,
context = applicationContext
));
Send data¶
Next, send data from your app or website to Amplitude.
amplitude.track("eventType", mutableMapOf<String, Any?>("test" to "event property value"))
amplitude.track("eventType", new HashMap() {{
put("test", "test event property value");
}});
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
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()
);
Learn more about Ampli Android.
Complete code example¶
Here's a complete example of how to use the SDK in your own app.
package com.amplitude.android.sample
import android.os.Bundle
import com.amplitude.core.events.Identify
import com.amplitude.android.Amplitude
import 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");
}});
}
}
Learn more available functionalities in Android SDK.
The iOS SDK lets you send events to Amplitude. See the full documentation at iOS SDK
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
pod 'Amplitude', '~> 8.8.0'
Add 'https://github.com/amplitude/Amplitude-iOS' to Package Dependency
github 'amplitude/Amplitude-iOS' ~> 8.8.0
Initialization¶
[[Amplitude instance] initializeApiKey:@"AMPLITUDE_API_KEY"];
Amplitude.instance().initializeApiKey(AMPLITUDE_API_KEY)
Send data¶
Next, send data from your app or website to Amplitude.
[[Amplitude instance] logEvent:@"Button Clicked"];
Amplitude.instance().logEvent("Button Click")
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
Ampli *ampli = [Ampli instance];
[ampli load];
[ampli yourEventType:[YourEventType stringProp:@[@"Strongly typed property"]
booleanProp:true]];
ampli.load();
ampli.yourEventType(
stringProp: "Strongly typed property",
booleanProp: true
)
Learn more about Ampli iOS.
Complete code example¶
Here's a complete example of how to use the SDK in your own app.
#import "Amplitude.h"
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[Amplitude instance] initializeApiKey:@"AMPLITUDE_API_KEY"];
AMPIdentify *identify = [[[AMPIdentify identify] set:@"gender" value:@"female"] set:@"age"
value:[NSNumber numberWithInt:20]];
[[Amplitude instance] identify:identify];
[[Amplitude instance] logEvent:@"app_start"];
return YES;
}
import Amplitude
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Amplitude.instance().initializeApiKey("AMPLITUDE_API_KEY")
let identify = AMPIdentify()
.set("gender", value: "female")
.set("age",value: NSNumber(value: 20))
Amplitude.instance().identify(identify)
Amplitude.instance().logEvent("app_start")
return true
}
Learn more available functionalities in iOS SDK.
This is the documentation for the Amplitude Analytics Java SDK. This is not the Android SDK. See the full documentation at Java SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
dependencies {
implementation 'org.json:json:20201115'
implementation 'com.amplitude:java-sdk:1.+'
}
Download the latest JAR file and add it to the project's buildpath. See instructions for your IDE.
Get the latest JAR file.
Initialization¶
Amplitude amplitude = Amplitude.getInstance();
amplitude.init(AMPLITUDE_API_KEY);
val amplitude = Amplitude.getInstance()
amplitude.init(AMPLITUDE_API_KEY)
Send data¶
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"));
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
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
)
)
Learn more about Ampli Java.
Complete code example¶
Here's a complete example of how to use the SDK in your own app.
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);
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)
Learn more in Java SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
pip install amplitude-analytics
Initialization¶
from amplitude import Amplitude
amplitude = Amplitude(AMPLITUDE_API_KEY)
Send data¶
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"
}
)
)
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
ampli.load()
ampli.yourEventType(
"user_id",
YourEventType(
stringProp= "Strongly typed property",
booleanProp=True
)
)
Learn more about Ampli Python.
Complete code example¶
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"
}
)
)
Learn more available functionalities in Python SDK.
The React Native SDK lets you send events to Amplitude. See the full documentation at React Native SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
npm install @amplitude/analytics-react-native
npm install @react-native-async-storage/async-storage
yarn add @amplitude/analytics-react-native
yarn add @react-native-async-storage/async-storage
expo install @amplitude/analytics-react-native
expo install @react-native-async-storage/async-storage
Install the native modules to run the SDK on iOS.
cd ios
pod install
Initialization¶
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');
Send data¶
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);
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
ampli.load();
ampli.yourEventType({
stringProp: 'Strongly typed property',
});
ampli.load();
ampli.yourEventType({
stringProp: 'Strongly typed property',
});
Learn more about Ampli React Native.
Complete code example¶
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);
Learn more available functionalities in React Native SDK.
The Flutter SDK lets you send events to Amplitude. See the full documentation at Flutter SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
dependencies:
amplitude_flutter: ^3.7.0
iOS installation also need to add platform :ios, '10.0'
to your Podfile.
Learn more about adding the dependency.
Initialization¶
import 'package:amplitude_flutter/amplitude.dart';
final Amplitude amplitude = Amplitude.getInstance();
amplitude.init(AMPLITUDE_API_KEY);
Send data¶
Next, send data from your app or website to Amplitude.
amplitude.logEvent('BUTTON_CLICKED', {"Hover Time": "100ms"});
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
More information TBD.
Complete code example¶
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
});
}
Learn more in Flutter SDK.
The Go SDK lets you send events to Amplitude. See the full documentation at Go SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
go get https://github.com/amplitude/analytics-go
Initialization¶
import (
"github.com/amplitude/analytics-go/amplitude"
)
config := amplitude.NewConfig(AMPLITUDE_API_KEY)
client := amplitude.NewClient(config)
Send data¶
Next, send data from your app or website to Amplitude.
amplitude.Track(amplitude.Event{
EventType: "Button Clicked",
EventOptions: amplitude.EventOptions{
UserID: "user-id",
DeviceID: "device-id",
},
EventProperties: map[string]interface{}{"source": "notification"},
})
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
Coming soon.
Complete code example¶
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)
amplitude := amplitude.NewClient(config)
identifyObj := amplitude.Identify{}
identifyObj.Set("location", "LAX")
amplitude.Identify(identifyObj, amplitude.EventOptions{UserID: "user-id"})
amplitude.Track(amplitude.Event{
EventType: "Button Clicked",
EventOptions: amplitude.EventOptions{
UserID: "user-id",
DeviceID: "device-id",
},
EventProperties: map[string]interface{}{"source": "notification"},
})
}
Learn more available functionalities in Go SDK.
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. See the full documentation at Unity SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
Add 'https://github.com/amplitude/unity-plugin.git?path=/Assets'.
Download amplitude-unity.unitypackage
Learn more about the Unity package download.
Initialization¶
Amplitude amplitude = Amplitude.getInstance()
amplitude.init("YOUR_API_KEY");
Send data¶
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
});
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
More information TBD.
Complete code example¶
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);
Learn more in Unity SDK.
The Amplitude Analytics Unreal Engine SDK supports projects targeting iOS, MacOS, or tvOS. See the full documentation at Unreal Engine SDK.
Table of Contents
Initialize the library¶
First, install dependencies and initialize the library in your app.
Install the dependency¶
Download SDK and add to project¶
- Download
AmplitudeUnreal.zip.
- Unzip it into a folder inside your Unreal project's Plugins directory.
Download the latest AmplitudeUnreal.zip.
Initialization¶
Enable the SDK plugin¶
Settings > Plugins > Project > Analytics
Learn more about how to enable SDK plugin.
Set Amplitude as your analytics provider¶
Settings -> Project Settings -> Analytics -> Providers
Learn more about how to set analytics provider.
Add your API keys¶
Settings -> Project Settings -> Analytics -> Amplitude
Learn more about how to set API keys.
#include "Runtime/Analytics/Analytics/Public/Analytics.h"
#include "Runtime/Analytics/Analytics/Public/Interfaces/IAnalyticsProvider.h"
Send data¶
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);
Check for success¶
After you begin sending data to Amplitude, use one of these tools to check your instrumentation and validate your events.
Ingestion Debugger¶
Use the Ingestion Debugger in Amplitude to check your requests, event and identify counts, and throttled users or devices.
- Log in to Amplitude.
- Click Data Source at the bottom of the navigation bar.
- Click the Ingestion Debugger tab.
Learn more about the Ingestion Debugger.
User lookup¶
After you fire an event, navigate to the User & Account Look-Up tab in Amplitude to validate your event.
Learn more about User Lookup.
Event Explorer¶
In any Amplitude chart, click Select events using your product. You are able to watch the events roll in, in near-real time.
Learn more about Event Explorer.
Enforce event schemas (Ampli)¶
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 in your production environments.
More information TBD.
Complete code example¶
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);
Learn more in Unreal SDK.
Still have questions? Ask them in the Community.