Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Feb 21, 2024

Create a custom plugin

AWS will end support for Amazon Pinpoint on October 30, 2026,, and is no longer accepting any new users as of May 20 (see the linked doc). The guidance is to use AWS End User Messaging for push notifications and SMS, Amazon Simple Email Service for sending emails, Amazon Connect for campaigns, journeys, endpoints, and engagement analytics. Pinpoint recommends Amazon Kinesis for event collection and mobile analytics.

You can create your custom pluggable for Analytics. This may be helpful if you want to integrate your app with a custom analytics backend.

To create a plugin implement the AnalyticsProvider interface:

import { Analytics, AnalyticsProvider } from 'aws-amplify';
export default class MyAnalyticsProvider implements AnalyticsProvider {
// category and provider name
static category = 'Analytics';
static providerName = 'MyAnalytics';
// you need to implement these four methods
// configure your provider
configure(config: object): object;
// record events and returns true if succeeds
record(params: object): Promise<boolean>;
// return 'Analytics';
getCategory(): string;
// return the name of you provider
getProviderName(): string;
}

You can now register your pluggable:

// add the plugin
Analytics.addPluggable(new MyAnalyticsProvider());
// get the plugin
Analytics.getPluggable(MyAnalyticsProvider.providerName);
// remove the plugin
Analytics.removePluggable(MyAnalyticsProvider.providerName);
// send configuration into Amplify
Analytics.configure({
MyAnalyticsProvider: {
// My Analytics provider configuration
}
});

The default provider (Amazon Pinpoint) is in use when you call Analytics.record() unless you specify a different provider: Analytics.record({..},'MyAnalytics').