@aws-amplify/analytics

  • Version 7.0.16
  • Published
  • 589 kB
  • 5 dependencies
  • Apache-2.0 license

Install

npm i @aws-amplify/analytics
yarn add @aws-amplify/analytics
pnpm add @aws-amplify/analytics

Overview

Analytics category of aws-amplify

Index

Functions

function configureAutoTrack

configureAutoTrack: (input: ConfigureAutoTrackInput) => void;
  • Configures automatic event tracking for Pinpoint. This API will automatically transmit an analytic event 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).

    Only session tracking is currently supported on React Native.

    Parameter params

    The input object to configure auto track behavior.

    Throws

    service: UpdateEndpointException - Thrown when the underlying Pinpoint service returns an error.

    Throws

    validation: AnalyticsValidationErrorCode - Thrown when the provided parameters or library configuration is incorrect.

function disable

disable: () => void;
  • Disables the Analytics category.

    When Analytics is disabled events will not be buffered or transmitted to your selected service. Any auto-tracking behavior that you have configured via configureAutoTrack will not have any effect while Analytics is disabled.

function enable

enable: () => void;
  • Enables the Analytics category to permit the transmission of events.

    Analytics is enabled by default. You do not need to call this API unless you have disabled Analytics.

function flushEvents

flushEvents: () => void;
  • Flushes all buffered Pinpoint events to the service.

    This API will make a best-effort attempt to flush events from the buffer. Events recorded immediately after invoking this API may not be included in the flush.

function identifyUser

identifyUser: ({
userId,
userProfile,
options,
}: IdentifyUserInput) => Promise<void>;
  • Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user profile and activities or actions in your application. Activity can be tracked across devices & platforms by using the same userId.

    Parameter params

    The input object used to construct requests sent to Pinpoint's UpdateEndpoint API.

    Returns

    A promise that will resolve when the operation is complete.

    Throws

    service: UpdateEndpointException - Thrown when the underlying Pinpoint service returns an error.

    Throws

    validation: AnalyticsValidationErrorCode - Thrown when the provided parameters or library configuration is incorrect.

    Example 1

    // Identify a user with Pinpoint
    await identifyUser({
    userId,
    userProfile: {
    email: 'userEmail@example.com'
    customProperties: {
    phoneNumber: ['555-555-5555'],
    },
    }
    });

    Example 2

    ```ts // Identify a user with Pinpoint with some additional demographics await identifyUser({ userId, userProfile: { email: 'userEmail@example.com' customProperties: { phoneNumber: ['555-555-5555'], }, demographic: { platform: 'ios', timezone: 'America/Los_Angeles' } } });

function record

record: (input: PinpointAnalyticsEvent) => void;
  • Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.

    Parameter params

    The input object used to construct the request.

    Throws

    validation: AnalyticsValidationErrorCode - Thrown when the provided parameters or library configuration is incorrect.

    Example 1

    // Send an event to Pinpoint
    record({ name: eventName })

    Example 2

    // Send an event to Pinpoint with metrics & custom attributes
    record({
    name: eventName,
    attributes: {
    'my-attribute': attributeValue
    },
    metrics: {
    'my-metric': metricValue
    }
    })

Type Aliases

type ConfigureAutoTrackInput

type ConfigureAutoTrackInput = AnalyticsConfigureAutoTrackInput;
  • Input type for Pinpoint configureAutoTrack API.

type IdentifyUserInput

type IdentifyUserInput = AnalyticsIdentifyUserInput<IdentifyUserOptions>;
  • Input type for Pinpoint identifyUser API.

type RecordInput

type RecordInput = PinpointAnalyticsEvent;
  • Input type for Pinpoint record API.

Package Files (8)

Dependencies (5)

Dev Dependencies (4)

Peer Dependencies (1)

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-amplify/analytics.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@aws-amplify/analytics)
  • HTML
    <a href="https://www.jsdocs.io/package/@aws-amplify/analytics"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>