目的
1.基于Amplify搭建aws的分析服務(wù)端。
2.client集成闲孤,AWSPinpoint來實(shí)現(xiàn)發(fā)生event谆级。
import AWSPinpoint
import AWSMobileClient
aws教程和源碼:
https://aws-amplify.github.io/docs/ios/analytics
https://github.com/aws-samples/aws-mobile-ios-notes-tutorial/blob/master/tutorial/analytics.md
一,配置服務(wù)器
1.需要用Amplify來配置aws的服務(wù)端
Analyze User Behavior - You can view trends about your users’ level of engagement, purchase activity, and demographics. You can monitor your message traffic with metrics for messages sent and opened. Through the Amazon Pinpoint API, your application can report custom data, which Amazon Pinpoint makes available for analysis.
The Amplify CLI helps setup and configure Pinpoint within your application and connect with the AWS Mobile SDK.
Prerequisite: Install and configure the Amplify CLI
Recommendation: Complete the Getting Started guide
配置教程
- 安裝node.js和npm
- 安裝Amplify CLI讼积,和設(shè)置config
$ npm install -g @aws-amplify/cli
$ amplify configure
- 在項(xiàng)目文件中肥照,配置amplify
$ cd ./YOUR_PROJECT_FOLDER
$ amplify add analytics
4.When configuration for analytics is complete, a message appears confirming that you have configured local CLI metadata for this category. You can confirm this by viewing status.
$ amplify status
| Category | Resource name | Operation | Provider plugin |
| --------- | --------------- | --------- | ----------------- |
| Auth | cognitoabcd0123 | Create | awscloudformation |
| Analytics | yourprojectname | Create | awscloudformation |
5.To create your backend AWS resources run the following:
$ amplify push
6.Update your IAM Policy: ?勤众?舆绎??们颜?
二吕朵,客戶端的處理
1.在podfile中添加
platform :ios, '9.0'
target 'YourAppName' do
use_frameworks!
pod 'AWSPinpoint', '~> 2.9.0'
pod 'AWSMobileClient', '~> 2.9.0'
end
三,如何查看視圖窥突,Monitor Analytics
通過命令行
$ amplify console analytics