1.基于AWS的iOS APP Analytics(配置篇)

目的

1.基于Amplify搭建aws的分析服务端。
2.client集成,AWSPinpoint来实现发生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

一,配置服务器

1.需要用Amplify来配置aws的服务端

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

配置教程

  1. 安装node.js和npm
  2. 安装Amplify CLI,和设置config
$ npm install -g @aws-amplify/cli
$ amplify configure
  1. 在项目文件中,配置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

你可能感兴趣的:(1.基于AWS的iOS APP Analytics(配置篇))