How to use @aws-amplify/analytics - 9 common examples

To help you get started, we’ve selected a few @aws-amplify/analytics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-js / packages / aws-amplify-react / src / Analytics / trackLifecycle.jsx View on Github external
track(event) {
			const filtered = this.trackEvents.filter(item => item === event);
			if (filtered.length > 0) {
				if (Analytics && typeof Analytics.record === 'function') {
					Analytics.record({
						name: this.trackerName,
						attributes: { event },
					});
				} else {
					throw new Error(
						'No Analytics module found, please ensure @aws-amplify/analytics is imported'
					);
				}
			}
		}
github aws-amplify / amplify-js / packages / aws-amplify-react / src / Analytics / trackUpdate.jsx View on Github external
componentDidUpdate(prevProps, prevState) {
			const attributes = Object.assign({}, this.props, this.state);
			if (Analytics && typeof Analytics.record === 'function') {
				Analytics.record({
					name: this.trackerName,
					attributes,
				});
			} else {
				throw new Error(
					'No Analytics module found, please ensure @aws-amplify/analytics is imported'
				);
			}
		}
github BoostIO / BoostNote.next / src / lib / analytics.ts View on Github external
(name: string, attributes?: { [key: string]: string }) => {
      if (analyticsEnabled) {
        if (attributes == null) {
          Analytics.record({ name: name })
        } else {
          Analytics.record({ name, attributes })
        }
      }
    },
    [analyticsEnabled]
github BoostIO / BoostNote.next / src / lib / analytics.ts View on Github external
Auth.configure(amplifyConfig)

const analyticsConfig = {
  AWSPinpoint: {
    appId: process.env.AMPLIFY_PINPOINT_APPID,
    region: process.env.AMPLIFY_PINPOINT_REGION,
    mandatorySignIn: false
  }
}

Analytics.configure(analyticsConfig)

const initilalized = (window as any).initilalized
if (!initilalized) {
  ;(window as any).initilalized = true
  Analytics.record('init')
}

export function useAnalytics() {
  const { preferences } = usePreferences()
  const analyticsEnabled = preferences['general.enableAnalytics']

  const report = useCallback(
    (name: string, attributes?: { [key: string]: string }) => {
      if (analyticsEnabled) {
        if (attributes == null) {
          Analytics.record({ name: name })
        } else {
          Analytics.record({ name, attributes })
        }
      }
    },
github aws-amplify / amplify-js / packages / aws-amplify-react / src / Analytics / trackUpdate.tsx View on Github external
componentDidUpdate(prevProps, prevState) {
			const attributes = Object.assign({}, this.props, this.state);
			if (Analytics && typeof Analytics.record === 'function') {
				Analytics.record({
					name: this.trackerName,
					attributes,
				});
			} else {
				throw new Error(
					'No Analytics module found, please ensure @aws-amplify/analytics is imported'
				);
			}
		}
github BoostIO / BoostNote.next / src / lib / analytics.ts View on Github external
identityPoolId: process.env.AMPLIFY_AUTH_IDENTITY_POOL_ID,
    region: process.env.AMPLIFY_AUTH_REGION
  }
}

Auth.configure(amplifyConfig)

const analyticsConfig = {
  AWSPinpoint: {
    appId: process.env.AMPLIFY_PINPOINT_APPID,
    region: process.env.AMPLIFY_PINPOINT_REGION,
    mandatorySignIn: false
  }
}

Analytics.configure(analyticsConfig)

const initilalized = (window as any).initilalized
if (!initilalized) {
  ;(window as any).initilalized = true
  Analytics.record('init')
}

export function useAnalytics() {
  const { preferences } = usePreferences()
  const analyticsEnabled = preferences['general.enableAnalytics']

  const report = useCallback(
    (name: string, attributes?: { [key: string]: string }) => {
      if (analyticsEnabled) {
        if (attributes == null) {
          Analytics.record({ name: name })

@aws-amplify/analytics

Analytics category of aws-amplify

Apache-2.0
Latest version published 4 days ago

Package Health Score

92 / 100
Full package analysis

Similar packages