UNPKG

@aws-amplify/analytics

Version:

Analytics category of aws-amplify

60 lines (59 loc) • 2.02 kB
import { AmplifyContext } from '@aws-amplify/core'; import { KinesisConfigureAutoTrackInput } from '../types'; export declare function configureAutoTrack(ctx: AmplifyContext, input: KinesisConfigureAutoTrackInput): void; /** * Configures automatic event tracking for Kinesis. This API will automatically transmit an analytic event to the * configured Kinesis stream when configured events are detected within your application. This can include: DOM * element events (via the `event` tracker), session events (via the `session` tracker), and page view events (via * the `pageView` tracker). * * Auto-tracked events are recorded with a data payload of the shape `{ name: eventName, attributes }`. * * @remark Only session tracking is currently supported on React Native. * * @param {KinesisConfigureAutoTrackInput} input The input object to configure auto track behavior. * * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library * configuration is incorrect, or when `streamName` / `partitionKey` are missing while enabling a tracker. * * @example * ```ts * // Enable session tracking * configureAutoTrack({ * enable: true, * type: 'session', * options: { * streamName: 'myKinesisStream', * partitionKey: 'myPartitionKey', * }, * }); * ``` * * @example * ```ts * // Enable page view tracking for a single-page application * configureAutoTrack({ * enable: true, * type: 'pageView', * options: { * streamName: 'myKinesisStream', * partitionKey: 'myPartitionKey', * appType: 'singlePage', * }, * }); * ``` * * @example * ```ts * // Enable DOM element event tracking * configureAutoTrack({ * enable: true, * type: 'event', * options: { * streamName: 'myKinesisStream', * partitionKey: 'myPartitionKey', * }, * }); * ``` */ export declare function configureAutoTrack(input: KinesisConfigureAutoTrackInput): void;