Hierarchy

  • Amplitude

Properties

instanceName: string

Methods

  • Add log callback, it can help read and collect error message from sdk. The call back function like the following format ({ tag, message }: { tag: string, message: string }) => { //implement your own logic }

    Parameters

    • callback: ((error: AmplitudeLogError) => void)
        • (error: AmplitudeLogError): void
        • Parameters

          • error: AmplitudeLogError

          Returns void

    Returns EmitterSubscription

  • Clears all properties that are tracked on the user level.

    Note: This operation is irreversible!!

    Returns Promise<boolean>

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

    Returns 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>

  • Enable/disable message logging by the SDK.

    Parameters

    • enableLogging: boolean

      whether to enable message logging by the SDK.

    Returns Promise<boolean>

  • Fetches the deviceId, a unique identifier shared between multiple users using the same app on the same device.

    Returns

    the deviceId.

    Returns Promise<null | string>

  • Fetches the sessionId, a timestamp used for log session event.

    Returns

    the sessionId.

    Returns Promise<number>

  • Set or update properties of particular groups

    Parameters

    Returns Promise<boolean>

  • Send an identify call containing user property operations to Amplitude servers.

    Parameters

    Returns Promise<boolean>

  • Parameters

    • apiKey: string

    Returns 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>

      The event's properties.

    • Optional extra: MiddlewareExtra

      Extra untyped parameters for use in middleware.

    Returns 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?: {
              [key: string]: any;
          };
          price: number;
          productId?: string;
          quantity?: number;
          receipt?: string;
          receiptSignature?: string;
          revenueType?: string;
      }
      • Optional eventProperties?: {
            [key: string]: any;
        }
        • [key: string]: any
      • price: number
      • Optional productId?: string
      • Optional quantity?: number
      • Optional receipt?: string
      • Optional receiptSignature?: string
      • Optional revenueType?: string

    Returns Promise<boolean>

  • Regenerate the DeviceId

    Returns Promise<boolean>

  • Use the Advertising ID on Android if available from Google Play Services. Must be called before init.

    Returns Promise<boolean>

  • Use the App Set ID (fall back to this if useAdvertisingIdForDeviceId is used) for device ID. Must be called before init.

    Returns 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>

  • Sets event upload max batch size. This controls the maximum number of events sent with each upload request.

    Parameters

    • eventUploadMaxBatchSize: number

      the event upload max batch size

    Returns Promise<boolean>

  • Sets event upload period millis. The SDK will attempt to batch upload unsent events every eventUploadPeriodMillis milliseconds, or if the unsent event count exceeds the event upload threshold.

    Parameters

    • eventUploadPeriodMillis: number

      the event upload period millis

    Returns Promise<boolean>

  • Sets event upload threshold. The SDK will attempt to batch upload unsent events every eventUploadPeriodMillis milliseconds, or if the unsent event count exceeds the event upload threshold.

    Parameters

    • eventUploadThreshold: number

      the event upload threshold

    Returns 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>

  • Sets ingestion metadata information.

    Parameters

    Returns Promise<boolean>

  • Sets the logging level. Logging messages will only appear if they are the same severity level or higher than the set log level.

    Parameters

    • logLevel: number

      the log level

    Returns 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>

  • 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>

  • Sets tracking plan information.

    Parameters

    • plan: Plan

      Plan object

    Returns Promise<boolean>

  • Customize the destination for server url.

    Parameters

    • serverUrl: string

    Returns Promise<boolean>

  • Set Amplitude Server Zone, switch to zone related configuration, including dynamic configuration. If updateServerUrl is true, including server url as well. Recommend to keep updateServerUrl to be true for alignment.

    Parameters

    • serverZone: string

      amplitude serverZone, US or EU, default is US

    • updateServerUrl: boolean = true

      if update server url when update server zone, recommend setting true

    Returns Promise<boolean>

  • Dynamically adjust server URL

    Parameters

    • useDynamicConfig: boolean

    Returns 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>

  • 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>

  • 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>

  • Upload all unsent events.

    Returns Promise<boolean>

  • Parameters

    • instanceName: string = ...

    Returns Amplitude

Generated using TypeDoc