How to use the aws-amplify.Analytics.record function in aws-amplify

To help you get started, we’ve selected a few aws-amplify 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-samples / aws-serverless-appsync-loyalty / src / App.js View on Github external
async createOrder(order){
    //Place the order
    console.log(order);
    const putOrder = await API.graphql(graphqlOperation(createOrder, order));
    console.log(JSON.stringify(putOrder));
    this.setState({order: putOrder.data.createOrder});
    this.setState({display: true}); //display Order component after a successfull purchase
    //Send Analytics data to Pinpoint
    Analytics.record({
      name: 'unicornsPurchase', 
      attributes: {}, 
      metrics: { totalOrder: order.totalOrder }
    });
    Analytics.record('_monetization.purchase', {
        _currency: 'USD',
        _product_id: order.itemId,
      }, {
        _item_price: order.unitPrice,
        _quantity: order.count,
      })
  }
github aws-samples / aws-serverless-appsync-loyalty / src / App.js View on Github external
async createOrder(order){
    //Place the order
    console.log(order);
    const putOrder = await API.graphql(graphqlOperation(createOrder, order));
    console.log(JSON.stringify(putOrder));
    this.setState({order: putOrder.data.createOrder});
    this.setState({display: true}); //display Order component after a successfull purchase
    //Send Analytics data to Pinpoint
    Analytics.record({
      name: 'unicornsPurchase', 
      attributes: {}, 
      metrics: { totalOrder: order.totalOrder }
    });
    Analytics.record('_monetization.purchase', {
        _currency: 'USD',
        _product_id: order.itemId,
      }, {
        _item_price: order.unitPrice,
        _quantity: order.count,
      })
  }
github pjay79 / PhotosApp / app / screens / PhotosScreen.js View on Github external
uploadPhotoToS3 = async (uri, key) => {
    try {
      this.setState({ uploading: true });
      const file = await RNFetchBlob.fs.readFile(uri, 'base64');
      const buffer = await Buffer.from(file, 'base64');
      await Storage.put(key, buffer, {
        contentType: 'image/jpeg',
      });
      this.setState({ uploading: false });
      Analytics.record({ name: 'cameraPhotoUploaded' });
      console.log('Photo uploaded!');
    } catch (error) {
      this.setState({ uploading: false });
      console.log(error.message);
    }
  };
github aws-amplify / amplify-js / packages / aws-amplify-react-native / dist / Auth / Authenticator.js View on Github external
}

        if (state === 'signedOut') {
            state = 'signIn';
        }
        this.setState({ authState: state, authData: data, error: null });
        if (this.props.onStateChange) {
            this.props.onStateChange(state, data);
        }

        switch (state) {
            case 'signedIn':
                Analytics.record('_userauth.sign_in');
                break;
            case 'signedUp':
                Analytics.record('_userauth.sign_up');
                break;
        }
    }
github aws-amplify / amplify-js / packages / aws-amplify-react-native / src / Auth / Authenticator.js View on Github external
handleStateChange(state, data) {
        logger.debug('authenticator state change ' + state);
        if (state === this.state.authState) { return; }

        if (state === 'signedOut') { state = 'signIn'; }
        this.setState({ authState: state, authData: data, error: null });
        if (this.props.onStateChange) { this.props.onStateChange(state, data); }

        switch(state) {
            case 'signedIn':
                Analytics.record('_userauth.sign_in');
                break;
            case 'signedUp':
                Analytics.record('_userauth.sign_up');
                break;
        }
    }
github aws-amplify / amplify-js / packages / aws-amplify-react-native / src / Auth / Authenticator.js View on Github external
if (!this._isMounted) return;
		if (state === this.state.authState) {
			return;
		}

		if (state === 'signedOut') {
			state = 'signIn';
		}
		this.setState({ authState: state, authData: data, error: null });
		if (this.props.onStateChange) {
			this.props.onStateChange(state, data);
		}

		switch (state) {
			case 'signedIn':
				Analytics.record('_userauth.sign_in');
				break;
			case 'signedUp':
				Analytics.record('_userauth.sign_up');
				break;
		}
	}
github aws-amplify / community / src / utilities / track.js View on Github external
const track = curry((name, attributes) => {
  if (!configured) {
    credentials && Amplify.configure(credentials);
    configured = true;
  }

  credentials && Analytics.record({name, attributes});
});
github aws-amplify / amplify-js / packages / aws-amplify-react-native / src / Auth / Authenticator.js View on Github external
}

		if (state === 'signedOut') {
			state = 'signIn';
		}
		this.setState({ authState: state, authData: data, error: null });
		if (this.props.onStateChange) {
			this.props.onStateChange(state, data);
		}

		switch (state) {
			case 'signedIn':
				Analytics.record('_userauth.sign_in');
				break;
			case 'signedUp':
				Analytics.record('_userauth.sign_up');
				break;
		}
	}