Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Amplitude

Index

Properties

instanceName

instanceName: string

Methods

clearUserProperties

  • clearUserProperties(): Promise<boolean>
  • Clears all properties that are tracked on the user level.

    Note: This operation is irreversible!!

    Returns Promise<boolean>

disableCoppaControl

  • disableCoppaControl(): Promise<boolean>
  • Disable COPPA (Children's Online Privacy Protection Act) restrictions on IDFA, IDFV, city, IP address and location tracking.

    Returns Promise<boolean>

enableCoppaControl

  • enableCoppaControl(): Promise<boolean>
  • Enable COPPA (Children's Online Privacy Protection Act) restrictions on IDFA, IDFV, city, IP address and location tracking.

    This can be used by any customer that does not want to collect IDFA, IDFV, city, IP address and location tracking.

    Returns Promise<boolean>

getDeviceId

  • getDeviceId(): Promise<string>
  • Fetches the deviceId, a unique identifier shared between multiple users using the same app on the same device.

    Returns Promise<string>

    the deviceId.

getSessionId

  • getSessionId(): Promise<number>
  • Fetches the sessionId, a timestamp used for log session event.

    Returns Promise<number>

    the sessionId.

groupIdentify

  • groupIdentify(groupType: string, groupName: string | string[], identifyInstance: Identify): Promise<boolean>
  • Set or update properties of particular groups

    Parameters

    • groupType: string
    • groupName: string | string[]
    • identifyInstance: Identify

    Returns Promise<boolean>

identify

  • identify(identifyInstance: Identify): Promise<boolean>
  • Send an identify call containing user property operations to Amplitude servers.

    Parameters

    Returns Promise<boolean>

init

  • init(apiKey: string): Promise<boolean>
  • Parameters

    • apiKey: string

    Returns Promise<boolean>

logEvent

  • logEvent(eventType: string, eventProperties?: Record<string, unknown>): Promise<boolean>
  • Tracks an event. Events are saved locally. Uploads are batched to occur every 30 events or every 30 seconds (whichever comes first), as well as on app close.

    Parameters

    • eventType: string

      The name of the event you wish to track.

    • Optional eventProperties: Record<string, unknown>

    Returns Promise<boolean>

logRevenue

  • logRevenue(userProperties: { eventProperties?: undefined | {}; price: number; productId?: undefined | string; quantity?: undefined | number; receipt?: undefined | string; receiptSignature?: undefined | string; revenueType?: undefined | string }): Promise<boolean>
  • Log revenue data.

    Note: price is a required field to log revenue events. If quantity is not specified then defaults to 1.

    Parameters

    • userProperties: { eventProperties?: undefined | {}; price: number; productId?: undefined | string; quantity?: undefined | number; receipt?: undefined | string; receiptSignature?: undefined | string; revenueType?: undefined | string }
      • Optional eventProperties?: undefined | {}
      • price: number
      • Optional productId?: undefined | string
      • Optional quantity?: undefined | number
      • Optional receipt?: undefined | string
      • Optional receiptSignature?: undefined | string
      • Optional revenueType?: undefined | string

    Returns Promise<boolean>

regenerateDeviceId

  • regenerateDeviceId(): Promise<boolean>
  • Regenerate the DeviceId

    Returns Promise<boolean>

setDeviceId

  • setDeviceId(deviceId: string): Promise<boolean>
  • Sets a custom device id. Note: only do this if you know what you are doing!

    Parameters

    • deviceId: string

      The device id.

    Returns Promise<boolean>

setGroup

  • setGroup(groupType: string, groupName: string | string[]): Promise<boolean>
  • Adds a user to a group or groups. You need to specify a groupType and groupName(s).

    Parameters

    • groupType: string
    • groupName: string | string[]

    Returns Promise<boolean>

setMinTimeBetweenSessionsMillis

  • setMinTimeBetweenSessionsMillis(minTimeBetweenSessionsMillis: number): Promise<boolean>
  • Sets the minimum cutoff time in millisseconds for sessions to be considered distinct. The default time is 5 minutes.

    Parameters

    • minTimeBetweenSessionsMillis: number

    Returns Promise<boolean>

setOptOut

  • setOptOut(optOut: boolean): Promise<boolean>
  • Enables tracking opt out.

    If the user wants to opt out of all tracking, use this method to enable opt out for them. Once opt out is enabled, no events will be saved locally or sent to the server.

    Calling this method again with enabled set to false will turn tracking back on for the user.

    Parameters

    • optOut: boolean

    Returns Promise<boolean>

setServerUrl

  • setServerUrl(serverUrl: string): Promise<boolean>
  • Customize the destination for server url.

    Parameters

    • serverUrl: string

    Returns Promise<boolean>

setUseDynamicConfig

  • setUseDynamicConfig(useDynamicConfig: boolean): Promise<boolean>
  • Dynamically adjust server URL

    Parameters

    • useDynamicConfig: boolean

    Returns Promise<boolean>

setUserId

  • setUserId(userId: null | string): Promise<boolean>
  • If your app has its own login system that you want to track users with, you can set the userId.

    Parameters

    • userId: null | string

    Returns Promise<boolean>

setUserProperties

  • setUserProperties(userProperties: Record<string, unknown>): Promise<boolean>
  • Adds properties that are tracked on the user level. Note: Property keys must be [String] objects and values must be serializable.

    Parameters

    • userProperties: Record<string, unknown>

    Returns Promise<boolean>

trackingSessionEvents

  • trackingSessionEvents(trackSessionEvents: boolean): Promise<boolean>
  • Whether to automatically log start and end session events corresponding to the start and end of a user's session.

    Parameters

    • trackSessionEvents: boolean

    Returns Promise<boolean>

uploadEvents

  • uploadEvents(): Promise<boolean>
  • Upload all unsent events.

    Returns Promise<boolean>

Static getInstance

  • getInstance(instanceName?: string): Amplitude
  • Parameters

    • instanceName: string = ...

    Returns Amplitude

Generated using TypeDoc