Amplitude (Actions) Destination
Additional versions of this destination are available
This page is about the Amplitude (Actions) Destination. See below for information about other versions of the Amplitude destination:
Amplitude is an event tracking and segmentation platform for your web and mobile apps. By analyzing the actions your users perform, you can gain a better understanding to drive retention, engagement, and conversion.
Benefits of Amplitude (Actions) vs Amplitude Classic
Amplitude (Actions) provides the following benefits over the classic Amplitude destination:
- Fewer settings. Data mapping for actions-based destinations happens in during configuration, which eliminates the need for most settings.
- Clearer mapping of data. Actions-based destinations enable you to define the mapping between the data Segment receives from your source, and the data Segment sends to the destination.
- Support for Amplitude’s HTTP API v2. Amplitude (Actions) is built on the latest version of Amplitude’s HTTP API.
- Revenue is a top-level property. Amplitude (Actions) elevates
revenue
to a top-level property in requests sent to Amplitude. This enables inclusion of this data in Amplitude features like customer LTV reports. - Tracking in cloud-mode. Amplitude (Actions) supports sending details from cloud-mode sources.
Getting started
- Before you start, go to your Amplitude workspace. Click Settings in the top right and then click Organization Settings to navigate to your Projects in the menu. Select your Project. Copy the Amplitude API Key and Secret Key for the project.
- From the Segment web app, click Catalog, then click Destinations.
- Find the Destinations Actions item in the left navigation, and click it.
- Click the “Amplitude” item to select it and click Configure.
- Choose which of your sources to connect the destination to. (You can connect more sources to the destination later.)
Once you have a mapping, you can follow the steps in the Destinations Actions documentation on Customizing mappings.
Log Purchases in existing destination instances
Initially, the Log Event Action was reporting purchases to Amplitude for all events containing a products
array, even if the products were just added to cart. This inflated the LTV Chart in Amplitude.
To resolve this, purchase reporting takes place in a new Action called Log Purchase.
For instances created prior to before the Log Purchases action was released, you need to manually add the Log Purchases Action to report purchases to Amplitude.
To manually add the Log Purchases Action:
- Add a new Mapping for the Log Purchases Action. The default trigger for this action is Order Completed events.
- Modify the Trigger if you need to report purchases for any other events.
- Modify the Trigger of Log Event to exclude these same events. This helps you to avoid sending the same event twice.
- Enable the Log Purchases mapping.
Connection Modes for Amplitude (Actions) destination
The Amplitude (Actions) destination does not offer a device-mode connection mode. Previous deployments of the Amplitude Segment destination required the device-mode connection to use the session_id
tracking feature. However, the Amplitude (Actions) destination now includes session ID tracking by default when you use Segment’s (Analytics.js 2.0 library.
Track sessions
Session tracking is available with Segment’s new libraries: Analytics.js 2.0, Swift or Kotlin.
When connected to the Analytics.js 2.0 source, Segment automatically loads a plugin on your website for session tracking and enrichment as an alternative to the Amplitude SDK. This means you don’t need to bundle any software or write any code to run on the user’s device, and can use more of the Segment platform features for data going to Amplitude, like Protocols filtering and transformations and Unify Identity Resolution.
If you’re using one of Segment’s Swift, Kotlin, or React Native libraries, you will need to include the Amplitude destination plugin to enable session tracking.
You can read more about Amplitude’s tracking sessions feature in Amplitude’s documentation.
Device ID Mappings
The Amplitude destination requires that each event include either a Device ID or a User ID. If a User ID isn’t present, Amplitude uses a Device ID, and vice versa, if a Device ID isn’t present, Amplitude uses the User ID.
By default, Segment maps the Segment property context.device.id
to the Amplitude property Device ID
. If context.device.id
isn’t available, Segment maps the property anonymousId
to the Amplitude Device ID
. The Actions interface indicates this with the following contents of the Device ID field: coalesce(
context.device.id
anonymousId
)
.
Enable session tracking for Analytics.js 2.0
JavaScript sources automatically enable session tracking.
The session ID Segment passes to Amplitude stores locally in a key-value pair. View the value associated with the analytics_session_id
key to access the session ID. The session ID is set to timeout every 30 minutes by default.
Enable Amplitude session tracking for Swift
To enable session tracking in Amplitude when using the Segment Swift library:
- Enable
trackApplicationLifecycleEvents
in your configuration. - Add the Amplitude Session plugin to your project.
- Initialize the plugin (example)
analytics?.add(plugin: AmplitudeSession(name: "Amplitude"))
Enable Amplitude session tracking for Kotlin
To enable session tracking in Amplitude when using the Segment Kotlin library:
- Enable
trackApplicationLifecycleEvents
in your configuration. - Add the Amplitude Session plugin to your project.
- Initialize the plugin
analytics.add(AmplitudeSession())
Enable Amplitude session tracking for iOS
To enable session tracking in Amplitude when using the Segment iOS library:
- Add the Amplitude Session middleware to your project.
- Add the middleware & enable
trackApplicationLifecycleEvents
in your configuration:NSString *const SEGMENT_WRITE_KEY = @" ... "; SEGAnalyticsConfiguration *configuration = [SEGAnalyticsConfiguration configurationWithWriteKey:SEGMENT_WRITE_KEY]; configuration.trackApplicationLifecycleEvents = true configuration.sourceMiddleware = @[[[SEGAmplitudeSession alloc] init]]; [SEGAnalytics setupWithConfiguration:configuration];
Enable Amplitude session tracking for Android
To enable session tracking in Amplitude when using the Segment Android library:
- Add the Amplitude Session middleware to your project.
implementation 'com.segment.analytics.android.integrations:amplitude:3.1.0'
- Add the middleware & enable
trackApplicationLifecycleEvents
in your configuration:String SEGMENT_WRITE_KEY = " ... "; analytics = new Analytics.Builder(this, SEGMENT_WRITE_KEY) .trackApplicationLifecycleEvents() .useSourceMiddleware(new AmplitudeSessionId()) .build();
Important differences from the classic Amplitude destination
The classic Amplitude destination captures the following user fields in device-mode (when it runs on the user’s device):
- Device Type (for example, Mac, PC, mobile device)
- Platform (for example iOS or Android)
Amplitude (Actions) runs in cloud-mode, and does not capture these fields.
Destination Settings
Setting | Description |
---|---|
API Key | Required. Amplitude project API key. You can find this key in the “General” tab of your Amplitude project. |
Endpoint Region | The region to send your data. |
Secret Key | Required. Amplitude project secret key. You can find this key in the “General” tab of your Amplitude project. |
Available Presets
Amplitude (Actions) has the following presets:
Preset Name | Trigger | Default Action |
---|---|---|
Track Calls | Event type = "track" and event != "Order Completed" |
Log Event V2 |
Identify Calls | Event type = "identify" |
Identify User |
Order Completed Calls | Event type = "track" and event = "Order Completed" |
Log Purchase |
Browser Session Tracking | Event type = "track" Event type = "identify" Event type = "group" Event type = "page" Event type = "alias" |
Session Plugin |
Screen Calls | Event type = "screen" |
Log Event V2 |
Page Calls | Event type = "page" |
Log Event V2 |
Available Actions
Build your own Mappings. Combine supported triggers with the following Amplitude-supported actions:
Mapping limits per destination
Individual destination instances have support a maximum of 50 mappings.
Map User
Merge two users together that would otherwise have different User IDs tracked in Amplitude.
Map User is a Cloud action. The default Trigger is: type = "alias"
Field | Description |
---|---|
User ID | Type: STRING The User ID to be associated. |
Global User ID | Type: STRING The Global User ID to associate with the User ID. |
Minimum ID Length | Type: INTEGER Amplitude has a default minimum id length ( |
Identify User
Set the user ID for a particular device ID or update user properties without sending an event to Amplitude.
Identify User is a Cloud action. The default Trigger is: type = "identify"
Field | Description |
---|---|
User ID | Type: STRING A UUID (unique user ID) specified by you. Note: If you send a request with a user ID that is not in the Amplitude system yet, then the user tied to that ID will not be marked new until their first event. Required unless device ID is present. |
Device ID | Type: STRING A device specific identifier, such as the Identifier for Vendor (IDFV) on iOS. Required unless user ID is present. |
User Properties | Type: OBJECT Additional data tied to the user in Amplitude. Each distinct value will show up as a user segment on the Amplitude dashboard. Object depth may not exceed 40 layers. Note: You can store property values in an array and date values are transformed into string values. |
Groups | Type: OBJECT Groups of users for Amplitude’s account-level reporting feature. Note: You can only track up to 5 groups. Any groups past that threshold will not be tracked. Note: This feature is only available to Amplitude Enterprise customers who have purchased the Amplitude Accounts add-on. |
App Version | Type: STRING Version of the app the user is on. |
Platform | Type: STRING The platform of the user’s device. |
OS Name | Type: STRING The mobile operating system or browser of the user’s device. |
OS Version | Type: STRING The version of the mobile operating system or browser of the user’s device. |
Device Brand | Type: STRING The brand of user’s the device. |
Device Manufacturer | Type: STRING The manufacturer of the user’s device. |
Device Model | Type: STRING The model of the user’s device. |
Carrier | Type: STRING The user’s mobile carrier. |
Country | Type: STRING The country in which the user is located. |
Region | Type: STRING The geographical region in which the user is located. |
City | Type: STRING The city in which the user is located. |
Designated Market Area | Type: STRING The Designated Market Area in which the user is located. |
Language | Type: STRING Language the user has set on their device or browser. |
Is Paying | Type: BOOLEAN Whether the user is paying or not. |
Initial Version | Type: STRING The version of the app the user was first on. |
Insert ID | Type: STRING Amplitude will deduplicate subsequent events sent with this ID we have already seen before within the past 7 days. Amplitude recommends generating a UUID or using some combination of device ID, user ID, event type, event ID, and time. |
User Agent | Type: STRING The user agent of the device sending the event. |
User Agent Parsing | Type: BOOLEAN Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field |
UTM Properties | Type: OBJECT UTM Tracking Properties |
Referrer | Type: STRING The referrer of the web request. Sent to Amplitude as both last touch “referrer” and first touch “initial_referrer” |
Minimum ID Length | Type: INTEGER Amplitude has a default minimum id length of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths. |
Library | Type: STRING The name of the library that generated the event. |
User Agent Data | Type: OBJECT The user agent data of device sending the event |
Log Event
Send an event to Amplitude.
Log Event is a Cloud action. The default Trigger is: type = "track"
Field | Description |
---|---|
User ID | Type: STRING A readable ID specified by you. Must have a minimum length of 5 characters. Required unless device ID is present. Note: If you send a request with a user ID that is not in the Amplitude system yet, then the user tied to that ID will not be marked new until their first event. |
Device ID | Type: STRING A device-specific identifier, such as the Identifier for Vendor on iOS. Required unless user ID is present. If a device ID is not sent with the event, it will be set to a hashed version of the user ID. |
Event Type* | Type: STRING A unique identifier for your event. |
Session ID | Type: DATETIME The start time of the session, necessary if you want to associate events with a particular system. To use automatic Amplitude session tracking in browsers, enable Analytics 2.0 on your connected source. |
Timestamp | Type: DATETIME The timestamp of the event. If time is not sent with the event, it will be set to the request upload time. |
Event Properties | Type: OBJECT An object of key-value pairs that represent additional data to be sent along with the event. You can store property values in an array, but note that Amplitude only supports one-dimensional arrays. Date values are transformed into string values. Object depth may not exceed 40 layers. |
User Properties | Type: OBJECT An object of key-value pairs that represent additional data tied to the user. You can store property values in an array, but note that Amplitude only supports one-dimensional arrays. Date values are transformed into string values. Object depth may not exceed 40 layers. |
Groups | Type: OBJECT Groups of users for the event as an event-level group. You can only track up to 5 groups. Note: This Amplitude feature is only available to Enterprise customers who have purchased the Accounts add-on. |
App Version | Type: STRING The current version of your application. |
Platform | Type: STRING Platform of the device. If using analytics.js to send events from a Browser and no if no Platform value is provided, the value “Web” will be sent. |
OS Name | Type: STRING The name of the mobile operating system or browser that the user is using. |
OS Version | Type: STRING The version of the mobile operating system or browser the user is using. |
Device Brand | Type: STRING The device brand that the user is using. |
Device Manufacturer | Type: STRING The device manufacturer that the user is using. |
Device Model | Type: STRING The device model that the user is using. |
Carrier | Type: STRING The carrier that the user is using. |
Country | Type: STRING The current country of the user. |
Region | Type: STRING The current region of the user. |
City | Type: STRING The current city of the user. |
Designated Market Area | Type: STRING The current Designated Market Area of the user. |
Language | Type: STRING The language set by the user. |
Price | Type: NUMBER The price of the item purchased. Required for revenue data if the revenue field is not sent. You can use negative values to indicate refunds. |
Quantity | Type: INTEGER The quantity of the item purchased. Defaults to 1 if not specified. |
Revenue | Type: NUMBER Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds. Note: You will need to explicitly set this if you are using the Amplitude in cloud-mode. |
Product ID | Type: STRING An identifier for the item purchased. You must send a price and quantity or revenue with this field. |
Revenue Type | Type: STRING The type of revenue for the item purchased. You must send a price and quantity or revenue with this field. |
Latitude | Type: NUMBER The current Latitude of the user. |
Longtitude | Type: NUMBER The current Longitude of the user. |
IP Address | Type: STRING The IP address of the user. Use “$remote” to use the IP address on the upload request. Amplitude will use the IP address to reverse lookup a user’s location (city, country, region, and DMA). Amplitude has the ability to drop the location and IP address from events once it reaches our servers. You can submit a request to Amplitude’s platform specialist team here to configure this for you. |
Identifier For Advertiser (IDFA) | Type: STRING Identifier for Advertiser. (iOS) |
Identifier For Vendor (IDFV) | Type: STRING Identifier for Vendor. (iOS) |
Google Play Services Advertising ID | Type: STRING Google Play Services advertising ID. (Android) |
Android ID | Type: STRING Android ID (not the advertising ID). (Android) |
Event ID | Type: INTEGER An incrementing counter to distinguish events with the same user ID and timestamp from each other. Amplitude recommends you send an event ID, increasing over time, especially if you expect events to occur simultanenously. |
Insert ID | Type: STRING Amplitude will deduplicate subsequent events sent with this ID we have already seen before within the past 7 days. Amplitude recommends generating a UUID or using some combination of device ID, user ID, event type, event ID, and time. |
Library | Type: STRING The name of the library that generated the event. |
Products | Type: OBJECT The list of products purchased. |
Use Batch Endpoint | Type: BOOLEAN If true, events are sent to Amplitude’s |
User Agent | Type: STRING The user agent of the device sending the event. |
User Agent Parsing | Type: BOOLEAN Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field |
UTM Properties | Type: OBJECT UTM Tracking Properties |
Referrer | Type: STRING The referrer of the web request. Sent to Amplitude as both last touch “referrer” and first touch “initial_referrer” |
Minimum ID Length | Type: INTEGER Amplitude has a default minimum id lenght of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths. |
User Agent Data | Type: OBJECT The user agent data of device sending the event |
Track Revenue Per Product
If you use Track Revenue Per Product, add a revenue
property inside the products
array of the Order Completed event.
Amplitude has two different ways to track revenue associated with a multi-product purchase. You can choose which method you want to use using the Track Revenue Per Product destination setting.
If you disable the setting (“off”), Segment sends a single revenue event with the total amount purchased and adds revenue data the Amplitude “Order Completed” event. The “Product Purchased” events do not contain any native Amplitude revenue data.
If you enable the setting (“on”), Segment sends a single revenue event for each purchased product and adds Revenue data to each “Product Purchased” event. The “Order Completed” event does not contain any native Amplitude revenue data.
Make sure you format your events using the Track method spec. You must pass a revenue
property, a price
property, and a quantity
property for each product in the products list.
Log Revenue v2
Segment’s iOS and Android sources can send revenue using Amplitude’s preferred logRevenueV2
method. Segment sets Amplitude’s special revenue properties, such as revenueType
and productIdentifier
, which Amplitude’s Revenue Analysis uses for Revenue Analysis and Revenue LTV charts. Segment uses the Amplitude eventProperties
field to send any properties not mapped to Amplitude’s special properties.
Amplitude Property | Segment Property | Description |
---|---|---|
productId |
productId |
An identifier for the product. |
quantity |
quantity |
The quantity of products purchased. Note: revenue = quantity * price . |
price |
price or revenue (or total for mobile, see note below) |
The price of the products purchased, and this can be negative. |
revenueType |
revenueType |
The revenue type (for example tax, refund, income). |
receiptSignature |
receiptSignature (Android) |
The receipt signature. |
receipt |
receipt |
Required if you want to verify the revenue event. |
eventProperties |
Any remaining properties | A NSDictionary or Map of event properties to include in the revenue event. |
* If properties.price
is not present, Segment uses revenue
instead, and sends that as price
. In Segment’s iOS and Android libraries, if revenue
isn’t present either, Segment sends the total
.
Property names should be camelCase
for Android implementations, and snake_case
for iOS implementations.
Amplitude does not support currency conversion. You should normalize all revenue data to your currency of choice before sending it to Amplitude.
Send To Batch Endpoint
This endpoint is available when you send data in Cloud-mode.
If true
, the destination sends events to Amplitude’s batch
endpoint rather than the httpapi
endpoint. Because Amplitude’s batch
endpoint throttles traffic less restrictively than the Amplitude httpapi
endpoint, enabling this setting can help to reduce 429 errors (throttling errors) from Amplitude.
Amplitude’s batch
endpoint throttles data when the rate of events sharing the same user_id
or device_id
exceeds an average of 1,000/second over a 30-second period. See the Amplitude documentation for more about 429 errors and throttling in Amplitude.
Group Identify User
Set or update properties of particular groups. Note that these updates will only affect events going forward.
Group Identify User is a Cloud action. The default Trigger is: type = "group"
Field | Description |
---|---|
User ID | Type: STRING A UUID (unique user ID) specified by you. Note: If you send a request with a user ID that is not in the Amplitude system yet, then the user tied to that ID will not be marked new until their first event. Required unless device ID is present. |
Device ID | Type: STRING A device specific identifier, such as the Identifier for Vendor (IDFV) on iOS. Required unless user ID is present. |
Insert ID | Type: STRING Amplitude will deduplicate subsequent events sent with this ID we have already seen before within the past 7 days. Amplitude recommends generating a UUID or using some combination of device ID, user ID, event type, event ID, and time. |
Timestamp | Type: STRING The timestamp of the event. If time is not sent with the event, it will be set to the request upload time. |
Group Properties | Type: OBJECT Additional data tied to the group in Amplitude. |
Group Type* | Type: STRING The type of the group |
Group Value* | Type: STRING The value of the group |
Minimum ID Length | Type: INTEGER Amplitude has a default minimum id lenght of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths. |
In the default configuration, Amplitude (Actions) triggers this mapping when it receives a Group call.
Groups are an enterprise feature in Amplitude, and are available if you’ve purchased the Accounts add-on.
This Action sets or updates the properties of specific groups. You can use this when you want to update a group’s information without sending an Event to Amplitude.
These Group updates affect events that occur after you set up the Amplitude mapping. You cannot use this to group historical data.
If you are on a Business Tier Segment plan, you can use Replay to run historical data through the Amplitude (Actions) destination to apply the grouping.
If you don’t have an enterprise Amplitude account, or don’t have the Accounts add-on, Segment always adds groups as user_properties
on a user record. As long as you specify the Action settings below, Segment adds a “group type” user property with a value of the “group value”.
To use Amplitude’s groups with Segment, you must enable the following Action settings and make sure to include the data values they need to function. These settings act as a mapping from Segment group traits to Amplitude group types and values.
-
“Amplitude Group Type Trait”: This specifies what trait in your Group calls contains the Amplitude “group type”. In other words, it’s how you tell Segment which trait to use as the group type.
-
“Amplitude Group Value Trait”: This specifies what trait in your Group calls contains the Amplitude “group value”. It’s how you tell Segment which trait to use as the group value.
Session Plugin
Generates a Session ID and attaches it to every Amplitude browser based event.
Session Plugin is a Web action. The default Trigger is: type = "track" or type = "identify" or type = "group" or type = "page" or type = "alias"
Field | Description |
---|---|
Session Length | Type: NUMBER Time in milliseconds to be used before considering a session stale. |
Log Purchase
Send an event to Amplitude.
Log Purchase is a Cloud action. The default Trigger is: type = "track"
Field | Description |
---|---|
Track Revenue Per Product | Type: BOOLEAN When enabled, track revenue with each product within the event. When disabled, track total revenue once for the event. |
User ID | Type: STRING A readable ID specified by you. Must have a minimum length of 5 characters. Required unless device ID is present. Note: If you send a request with a user ID that is not in the Amplitude system yet, then the user tied to that ID will not be marked new until their first event. |
Device ID | Type: STRING A device-specific identifier, such as the Identifier for Vendor on iOS. Required unless user ID is present. If a device ID is not sent with the event, it will be set to a hashed version of the user ID. |
Event Type* | Type: STRING A unique identifier for your event. |
Session ID | Type: DATETIME The start time of the session, necessary if you want to associate events with a particular system. To use automatic Amplitude session tracking in browsers, enable Analytics 2.0 on your connected source. |
Timestamp | Type: DATETIME The timestamp of the event. If time is not sent with the event, it will be set to the request upload time. |
Event Properties | Type: OBJECT An object of key-value pairs that represent additional data to be sent along with the event. You can store property values in an array, but note that Amplitude only supports one-dimensional arrays. Date values are transformed into string values. Object depth may not exceed 40 layers. |
User Properties | Type: OBJECT An object of key-value pairs that represent additional data tied to the user. You can store property values in an array, but note that Amplitude only supports one-dimensional arrays. Date values are transformed into string values. Object depth may not exceed 40 layers. |
Groups | Type: OBJECT Groups of users for the event as an event-level group. You can only track up to 5 groups. Note: This Amplitude feature is only available to Enterprise customers who have purchased the Accounts add-on. |
App Version | Type: STRING The current version of your application. |
Platform | Type: STRING Platform of the device. If using analytics.js to send events from a Browser and no if no Platform value is provided, the value “Web” will be sent. |
OS Name | Type: STRING The name of the mobile operating system or browser that the user is using. |
OS Version | Type: STRING The version of the mobile operating system or browser the user is using. |
Device Brand | Type: STRING The device brand that the user is using. |
Device Manufacturer | Type: STRING The device manufacturer that the user is using. |
Device Model | Type: STRING The device model that the user is using. |
Carrier | Type: STRING The carrier that the user is using. |
Country | Type: STRING The current country of the user. |
Region | Type: STRING The current region of the user. |
City | Type: STRING The current city of the user. |
Designated Market Area | Type: STRING The current Designated Market Area of the user. |
Language | Type: STRING The language set by the user. |
Price | Type: NUMBER The price of the item purchased. Required for revenue data if the revenue field is not sent. You can use negative values to indicate refunds. |
Quantity | Type: INTEGER The quantity of the item purchased. Defaults to 1 if not specified. |
Revenue | Type: NUMBER Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds. Note: You will need to explicitly set this if you are using the Amplitude in cloud-mode. |
Product ID | Type: STRING An identifier for the item purchased. You must send a price and quantity or revenue with this field. |
Revenue Type | Type: STRING The type of revenue for the item purchased. You must send a price and quantity or revenue with this field. |
Latitude | Type: NUMBER The current Latitude of the user. |
Longtitude | Type: NUMBER The current Longitude of the user. |
IP Address | Type: STRING The IP address of the user. Use “$remote” to use the IP address on the upload request. Amplitude will use the IP address to reverse lookup a user’s location (city, country, region, and DMA). Amplitude has the ability to drop the location and IP address from events once it reaches our servers. You can submit a request to Amplitude’s platform specialist team here to configure this for you. |
Identifier For Advertiser (IDFA) | Type: STRING Identifier for Advertiser. (iOS) |
Identifier For Vendor (IDFV) | Type: STRING Identifier for Vendor. (iOS) |
Google Play Services Advertising ID | Type: STRING Google Play Services advertising ID. (Android) |
Android ID | Type: STRING Android ID (not the advertising ID). (Android) |
Event ID | Type: INTEGER An incrementing counter to distinguish events with the same user ID and timestamp from each other. Amplitude recommends you send an event ID, increasing over time, especially if you expect events to occur simultanenously. |
Insert ID | Type: STRING Amplitude will deduplicate subsequent events sent with this ID we have already seen before within the past 7 days. Amplitude recommends generating a UUID or using some combination of device ID, user ID, event type, event ID, and time. |
Library | Type: STRING The name of the library that generated the event. |
Products | Type: OBJECT The list of products purchased. |
Use Batch Endpoint | Type: BOOLEAN If true, events are sent to Amplitude’s |
User Agent | Type: STRING The user agent of the device sending the event. |
User Agent Parsing | Type: BOOLEAN Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field |
UTM Properties | Type: OBJECT UTM Tracking Properties |
Referrer | Type: STRING The referrer of the web request. Sent to Amplitude as both last touch “referrer” and first touch “initial_referrer” |
Minimum ID Length | Type: INTEGER Amplitude has a default minimum id lenght of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths. |
User Agent Data | Type: OBJECT The user agent data of device sending the event |
Log Event V2
Send an event to Amplitude
Log Event V2 is a Cloud action. The default Trigger is: type = "track"
Field | Description |
---|---|
User ID | Type: STRING A readable ID specified by you. Must have a minimum length of 5 characters. Required unless device ID is present. Note: If you send a request with a user ID that is not in the Amplitude system yet, then the user tied to that ID will not be marked new until their first event. |
Device ID | Type: STRING A device-specific identifier, such as the Identifier for Vendor on iOS. Required unless user ID is present. If a device ID is not sent with the event, it will be set to a hashed version of the user ID. |
Event Type* | Type: STRING A unique identifier for your event. |
Session ID | Type: DATETIME The start time of the session, necessary if you want to associate events with a particular system. To use automatic Amplitude session tracking in browsers, enable Analytics 2.0 on your connected source. |
Timestamp | Type: DATETIME The timestamp of the event. If time is not sent with the event, it will be set to the request upload time. |
Event Properties | Type: OBJECT An object of key-value pairs that represent additional data to be sent along with the event. You can store property values in an array, but note that Amplitude only supports one-dimensional arrays. Date values are transformed into string values. Object depth may not exceed 40 layers. |
User Properties | Type: OBJECT An object of key-value pairs that represent additional data tied to the user. You can store property values in an array, but note that Amplitude only supports one-dimensional arrays. Date values are transformed into string values. Object depth may not exceed 40 layers. |
Groups | Type: OBJECT Groups of users for the event as an event-level group. You can only track up to 5 groups. Note: This Amplitude feature is only available to Enterprise customers who have purchased the Accounts add-on. |
App Version | Type: STRING The current version of your application. |
Platform | Type: STRING Platform of the device. If using analytics.js to send events from a Browser and no if no Platform value is provided, the value “Web” will be sent. |
OS Name | Type: STRING The name of the mobile operating system or browser that the user is using. |
OS Version | Type: STRING The version of the mobile operating system or browser the user is using. |
Device Brand | Type: STRING The device brand that the user is using. |
Device Manufacturer | Type: STRING The device manufacturer that the user is using. |
Device Model | Type: STRING The device model that the user is using. |
Carrier | Type: STRING The carrier that the user is using. |
Country | Type: STRING The current country of the user. |
Region | Type: STRING The current region of the user. |
City | Type: STRING The current city of the user. |
Designated Market Area | Type: STRING The current Designated Market Area of the user. |
Language | Type: STRING The language set by the user. |
Price | Type: NUMBER The price of the item purchased. Required for revenue data if the revenue field is not sent. You can use negative values to indicate refunds. |
Quantity | Type: INTEGER The quantity of the item purchased. Defaults to 1 if not specified. |
Revenue | Type: NUMBER Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds. Note: You will need to explicitly set this if you are using the Amplitude in cloud-mode. |
Product ID | Type: STRING An identifier for the item purchased. You must send a price and quantity or revenue with this field. |
Revenue Type | Type: STRING The type of revenue for the item purchased. You must send a price and quantity or revenue with this field. |
Latitude | Type: NUMBER The current Latitude of the user. |
Longtitude | Type: NUMBER The current Longitude of the user. |
IP Address | Type: STRING The IP address of the user. Use “$remote” to use the IP address on the upload request. Amplitude will use the IP address to reverse lookup a user’s location (city, country, region, and DMA). Amplitude has the ability to drop the location and IP address from events once it reaches our servers. You can submit a request to Amplitude’s platform specialist team here to configure this for you. |
Identifier For Advertiser (IDFA) | Type: STRING Identifier for Advertiser. (iOS) |
Identifier For Vendor (IDFV) | Type: STRING Identifier for Vendor. (iOS) |
Google Play Services Advertising ID | Type: STRING Google Play Services advertising ID. (Android) |
Android ID | Type: STRING Android ID (not the advertising ID). (Android) |
Event ID | Type: INTEGER An incrementing counter to distinguish events with the same user ID and timestamp from each other. Amplitude recommends you send an event ID, increasing over time, especially if you expect events to occur simultanenously. |
Insert ID | Type: STRING Amplitude will deduplicate subsequent events sent with this ID we have already seen before within the past 7 days. Amplitude recommends generating a UUID or using some combination of device ID, user ID, event type, event ID, and time. |
Library | Type: STRING The name of the library that generated the event. |
Products | Type: OBJECT The list of products purchased. |
Set Once | Type: OBJECT The following fields will be set only once per session when using AJS2 as the source. |
Set Always | Type: OBJECT The following fields will be set every session when using AJS2 as the source. |
Add | Type: OBJECT Increment a user property by a number with add. If the user property doesn’t have a value set yet, it’s initialized to 0. |
Use Batch Endpoint | Type: BOOLEAN If true, events are sent to Amplitude’s |
User Agent | Type: STRING The user agent of the device sending the event. |
User Agent Parsing | Type: BOOLEAN Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field. |
Minimum ID Length | Type: INTEGER Amplitude has a default minimum id length of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths. |
User Agent Data | Type: OBJECT The user agent data of device sending the event |
Migration from Amplitude Classic
Keep the following in mind if you plan to move to Amplitude (Actions) from a classic Amplitude destination.
In some cases, Amplitude Classic uses different default mappings than Amplitude (Actions). For example, the Viewed Home Page
event in Amplitude Classic will be Viewed Home
in Amplitude Actions, unless you configure it as Viewed Home Page
. Be sure to follow the steps in the Destination Actions documentation to customize your mappings. Review how events appear in each destination, and configure the Actions’ mappings properly to maintain continuity between Classic and Actions destinations.
Amplitude (Actions) uses Amplitude’s HTTP API v2
If you used Amplitude Classic in cloud-mode, you’ll notice different responses from Amplitude to calls you make with the destination. Classic Amplitude was built on Amplitude’s now-deprecated HTTP API v1.
You configure the Amplitude (Actions) destination through Filters and Actions. Consult the table below for information about configuring your Amplitude (Actions) destination similarly to your classic Amplitude destination.
Contact Segment support if you find features missing from the Amplitude (Actions) destination that were available in the classic Amplitude destination.
Set Once/Set Always fields
Amplitude restricts the mixing of top-level user properties with $set
, $setOnce
, or $setAlways
operations in a single request, as outlined in Amplitude’s documentation.
To circumvent this within Segment, users can opt to exclusively map event parameters to either the User Properties field or to one of the user property operations (Set Once and/or Set Always) available in mappings. If you use the Set Once and/or Set Always fields, include all relevant fields in their respective mappings and do not configure mappings for User Properties in the same request.
Conversely, to send top-level user properties, map only to the User Properties field and exclude mappings for the Set Once and Set Always fields.
Amplitude settings mapping
amplitude Classic Destination Setting | How to enable in amplitude (Actions) | |
---|---|---|
Connection Settings | ||
API Key Cloud Device-web Device-mobile |
Global Setting |
|
Track Products Once Device-web |
Not applicable to Cloud mode |
|
Version Name Device-web |
Action field App Version. Defaults to |
|
Connection Mode Cloud Device-web Device-mobile |
Actions support Cloud mode connections |
|
Page and Screen | ||
Track all pages to Amplitude Cloud Device-web Device-mobile |
Subscription Page Calls When enabled, Amplitude (Actions) tracks all Page calls by default |
|
Track all Screens Cloud Device-web Device-mobile |
Subscription Page Calls When enabled, Amplitude (Actions) tracks all Screen calls by default |
|
Track Categorized Pages to Amplitude Cloud Device-web Device-mobile |
Subscription Page Calls Add a Trigger filter condition to check that Event Property category exists |
|
Track Named Pages to Amplitude Cloud Device-web Device-mobile |
Subscription Page Calls Add a Trigger filter condition to check that Event Property name exists |
|
Traits | ||
Group Type Trait Cloud Device-web Device-mobile |
Subscription Group Identify User. Select a value in the Group Type actions field. This field is mandatory in Amplitude (Actions). In the Amplitude Classic destination, ommiting a value for property field resulted in Amplitude creating a group called |
|
Group Value Trait Cloud Device-web Device-mobile |
Subscription Group Identify User. Select a value in the Group Value actions field. This field is mandatory in Amplitude actions. In the Amplitude Classic destination, ommiting a value for this property resulted in an alpha-numeric value. |
|
Traits to Append Cloud |
Not supported with Actions |
|
Traits to Increment Cloud Device-web Device-mobile |
Not supported with Actions |
|
Traits to Prepend Cloud |
Not supported with Actions |
|
Traits to Set Once Cloud Device-web Device-mobile |
Not supported with Actions |
|
Other Settings | ||
Append Fields to Event Properties Device-web Device-mobile |
Not supported with Actions |
|
Batch Events Device-web |
Use Batch Endpoint field on the Log Event action |
|
Enable Location Listening Device-mobile |
Use |
|
Event Upload period millis Device-web |
Not configurable for Cloud-mode batching |
|
Event Upload Threshold Device-web |
Not configurable for Cloud-mode batching |
|
Force HTTPS Device-web |
Not configurable in Cloud-mode, https is enabled by default. |
|
Map Query Params to Custom Property Cloud Device-web |
Not supported with Actions |
|
Prefer Anonymous Device ID Cloud Device-web Device-mobile |
Actions field Device ID. Replace the contents of the field with your preferred value. |
|
Save Referrer, URL Params, GCLID Once per Session Device-web |
This setting supported an edge case that is not applicable to Amplitude (Actions) |
|
Secret Key Cloud Device-web Device-mobile |
Global Setting |
|
Enable Alias Cloud |
Use the Map User action. The Map User action is not enabled by default. Add a new Subscription to access the Map User action. |
|
Send to Batch Endpoint Cloud |
Use Batch Endpoint field on the Log Event action |
|
Track GCLID Device-web |
Not supported with Actions |
|
Track Referrer to Amplitude Device-web |
Update the User Properties mapping to send |
|
Track Revenue per Product Cloud Device-web Device-mobile |
Actions field Track Revenue Per Product. Available in any subscription that uses the Log Event action. |
|
Track Session Events to Amplitude Device-web |
This setting sends |
|
Track UTM Properties to Amplitude Cloud Device-web |
Supported by default. See the UTM Properties section to view the mappings. |
|
Unset Params Referrer on New Session Device-web |
Not supported with Actions |
|
Use Advertising ID for Device ID Cloud Device-web Device-mobile |
Actions field Device ID. Update the value so your preferred field appears first in the |
|
Send Custom Language and Country Properties |
Actions fields Language and Country These fields are set by default with values from the context object. |
|
Use Log Revenue v2 API Device-web Device-mobile |
Actions supports Revenue v2. Confirm revenue reporting is working as expected if you migrate from the Classic Amplitude destination where this setting was disabled |
Advanced Amplitude (Actions) settings
Increment Traits
The traitsToIncrement
setting increases a user property by some numerical value. If the user property does not have a value set yet, Segment initializes it with a value of 0. The trait must have a numerical value so it can be incremented.
In the following example, the Amplitude User property friendCount
equals 4.
"traits" : {"$add": {"friendCount": 3} }
"traits" : {"$add": {"friendCount": 1} }
FAQs and troubleshooting
Does Segment load the Amplitude SDK on the webpage to collect data?
Segment doesn’t load the Amplitude SDK directly on the webpage. Instead, Segment collects data using the Analytics.js library. Once events reach Segment’s servers, they are forwarded to Amplitude’s servers using Amplitude’s HTTP API.
How does Segment handle the Amplitude session ID?
The Analytics.js library includes a plugin that sets the Amplitude session ID on the device. This session ID is used to track sessions and is automatically attached to events sent to Amplitude. By default, the session ID is set to timeout after 30 minutes of inactivity. You can review the code implementation for setting the session ID.
How can I retrieve the Amplitude session ID set by Segment?
Since Segment doesn’t load the Amplitude SDK, the Amplitude native method amplitude.getInstance()._sessionId
won’t work. You can retrieve the session ID using the this method:
localStorage.getItem('analytics_session_id');
This call accesses the session ID stored in the browser’s local storage. You can review the retrieval code.
Why doesn’t Segment automatically add the session_id to my Web Events?
For Segment to automatically add the session_id to your web events, your website must allow the following URL:
https://cdn.segment.com/next-integrations/actions/amplitude-plugins/..
To check if your website allows the URL:
- Open your browser’s developer tools and inspect the network requests on your website.
- Look for a request related to Amplitude.
If the request is missing:
- Ensure your browser settings or network configuration allow the URL to load.
- Check for any third-party script blockers or restrictions that might prevent it.
This page was last modified: 19 Dec 2024
Need support?
Questions? Problems? Need more info? Contact Segment Support for assistance!