Skip to content

Commit

Permalink
Fix crypto and update docs (#198)
Browse files Browse the repository at this point in the history
* add cognito js lib and update references

* update cognito lib

* update node version and package deps

* update cognito sdk and auth test

* update travis commands

* update react tests

* update travis

* update with yarn workspaces and modules

* update with yarn workspaces and modules

* add lint to test

* update test cmd

* update test cmd

* update test cmd

* update build cmds

* update concurrency with bootstrap

* set yarn workspaces

* update travis

* update deps, yarn should use local

* remove workspaces

* update workspaces

* add build before test for workspaces

* update travis

* remove package-lock.json

* update rn package

* update deps on react native

* update user attributes

* update user attributes

* fix variable

* update docs

* for rn

* core change

* Update package.json

* Adds a podspec for CocoaPods support

* update docs with cli instructions

* update quick start

* update quick start

* update crypto lib for react native and polyfill methods
  • Loading branch information
mlabieniec committed Jan 29, 2018
1 parent 3c60b68 commit eab355c
Show file tree
Hide file tree
Showing 71 changed files with 13,593 additions and 17,928 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ You will need to [link](https://facebook.github.io/react-native/docs/linking-lib

## Documentation

* [Quick Start](media/quick_start.md)
* [API Reference](media/api_reference.md)
* [Developer Guide](media/developer_guide.md)
* [Installation and Configuration](media/install_n_config.md)
* [Authentication](media/authentication_guide.md)
* [Analytics](media/analytics_guide.md)
* [API](media/api_guide.md)
* [Storage](media/storage_guide.md)
* [Cache](media/cache_guide.md)
* [Quick Start](docs/media/quick_start.md)
* [API Reference](docs/media/api_reference.md)
* [Developer Guide](docs/media/developer_guide.md)
* [Installation and Configuration](docs/media/install_n_config.md)
* [Authentication](docs/media/authentication_guide.md)
* [Analytics](docs/media/analytics_guide.md)
* [API](docs/media/api_guide.md)
* [Storage](docs/media/storage_guide.md)
* [Cache](docs/media/cache_guide.md)
* Utilities
- [I18n](media/i18n_guide.md)
- [Logger](media/logger_guide.md)
- [Hub](media/hub_guide.md)
- [I18n](docs/media/i18n_guide.md)
- [Logger](docs/media/logger_guide.md)
- [Hub](docs/media/hub_guide.md)

## Examples

AWS Amplify supports many category scenarios such as Auth, Analytics, APIs and Storage as outlined in the [Developer Guide](media/developer_guide.md). A couple of samples are below.
AWS Amplify supports many category scenarios such as Auth, Analytics, APIs and Storage as outlined in the [Developer Guide](docs/media/developer_guide.md). A couple of samples are below.

### 1. Collect user session metrics

Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ coverage:
status:
project:
default:
target: 95%
target: 90%
if_not_found: success
File renamed without changes
88 changes: 31 additions & 57 deletions docs/media/analytics_guide.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
# Analytics

AWS Amplify Analytics module helps developer collect analytic metrics.
AWS Amplify Analytics module helps you quickly collect analytics for user sessions, custom attributes or metrics.

* [Installation](#installation)
* [Configuration](#configuration)
* [Installation and Configuration](#installation-and-configuration)
- [Manual Setup](#manual-setup)
- [Automated Setup](#automated-setup)
* [Integration](#integration)
- [1. Collect Session Data](#1-collect-session-data)
- [2. Record Event](#2-record-event)
- [3. Record Event with Attributes](#3-record-event-with-attributes)
- [4. Record Event with Metrics](#4-record-event-with-metrics)

## Installation
## Installation and Configuration

For Web development, regardless of framework, `aws-amplify` provides core Auth APIs
```
npm install aws-amplify
```

On React app, we have provided some helpful components in `aws-amplify-react`
```
npm install aws-amplify-react
```

In React Native development, we package core APIs and components into one `aws-amplify-react-native`
```
npm install aws-amplify-react-native
```
Please refer to this [Guide](install_n_config.md) for general setup. Here are Analytics specific setup.

## Configuration
### Manual Setup

```
```js
import Amplify from 'aws-amplify';

Amplify.configure(
Expand All @@ -48,80 +36,66 @@ Amplify.configure(

In the above configuration you are required to pass in an Amazon Cognito Identity Pool ID so that the library can retrieve base credentials for a user even in an UnAuthenticated state. If you pass in properties in the Analytics section for Amazon Pinpoint the library will automatically track some base metrics for you without any effort on your part.

### Manual Setup
[Amazon Cognito Identity](http://docs.aws.amazon.com/cognito/latest/developerguide/getting-started-with-identity-pools.html)

[Amazon Pinpoint](http://docs.aws.amazon.com/pinpoint/latest/developerguide/getting-started.html)

### Automated Setup

AWS Mobile Hub streamlines the steps above for you. Simply click the button:

<p align="center">
<a target="_blank" href="https://console.aws.amazon.com/mobilehub/home?#/?config=https://github.com/aws/aws-amplify/blob/master/media/backend/import_mobilehub/analytics.zip">
<span>
<img height="100%" src="https://s3.amazonaws.com/deploytomh/button-deploy-aws-mh.png"/>
</span>
</a>
</p>
To create a project fully functioning with the Analytics category.

This will create a project that works with Analytics category fully functioning. After the project is created in the Mobile Hub console download aws-exports.js by clicking the **Hosting and Streaming** tile then **Download aws-exports.js**.

![Mobile Hub](mobile_hub_1.png)

Download aws-exports.js
```
$ npm install -g awsmobile-cli
$ cd my-app
$ awsmobile init
$ awsmobile enable analytics
```

Then copy the file to `/src` folder of the project
![Download](mobile_hub_2.png)
In your project i.e. App.js:

```
import Amplify, { Analytics } from 'aws-amplify';
import aws_exports from './aws-exports';
Amplify.configure(aws_exports);
```

Now you can simply import the file and pass it as the configuration to the Amplify library:
After configuration, user session metrics are automatically collected and send to Amazon Pinpoint. To see these metrics click [here](https://console.aws.amazon.com/pinpoint/home/), or on the cli (from your project directory):

Add these lines to your source.
```
import Amplify from 'aws-amplify';
import aws_exports from './aws-exports.js';
Amplify.configure(aws_exports);
$ awsmobile console
```

After configuration, user session metrics are automatically collected and send to Amazon Pinpoint. To see these metrics click [here](https://console.aws.amazon.com/pinpoint/home/) or in your Mobile Hub project click the **Engage** tab on the left of the screen.
Then click **Analytics**.

![Session](mobile_hub_3.png)

## Integration

### 1. Collect Session Data

Without additional code. Once correctly configured, Analytics module starts collect session data.

All you need to do is to configure Analytics module. See [configuration](#configuration)
Without any additional code, the Analytics module starts collect session data. All you need to do is to configure Analytics module.

### 2. Record Event

To record an event, call `record` method
To record an event, call the `record` method:

```
```js
import { Analytics } from 'aws-amplify';

Analytics.record('albumVisit');
```

### 3. Record Event with Attributes

`record` method let you add additional attributes to event. For example,
The `record` method lets you add additional attributes to an event. For example:

```
```js
import { Analytics } from 'aws-amplify';

Analytics.record('albumVisit', { genre: '', artist: '' });
```

### 4. Record Event with Metrics

Metrics can be added to event too.
Metrics can also be added to an event:

```
```js
import { Analytics } from 'aws-amplify';

Analytics.record('albumVisit', {}, { minutesListened: 30 });
Expand Down
Loading

0 comments on commit eab355c

Please sign in to comment.