Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goatandsheep/aws-web-analytics
Privacy-focused alternative to Google Analytics on AWS Pinpoint
https://github.com/goatandsheep/aws-web-analytics
amplify-js analytics aws google-analytics help-wanted
Last synced: 18 days ago
JSON representation
Privacy-focused alternative to Google Analytics on AWS Pinpoint
- Host: GitHub
- URL: https://github.com/goatandsheep/aws-web-analytics
- Owner: goatandsheep
- License: gpl-3.0
- Created: 2020-01-16T04:59:37.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-10T17:52:08.000Z (about 1 month ago)
- Last Synced: 2024-10-11T22:09:11.731Z (about 1 month ago)
- Topics: amplify-js, analytics, aws, google-analytics, help-wanted
- Language: JavaScript
- Homepage: https://console.aws.amazon.com/pinpoint/home
- Size: 983 KB
- Stars: 48
- Watchers: 4
- Forks: 1
- Open Issues: 54
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS Web Analytics
Tracking tag library for AWS Pinpoint as an alternative to Google Analytics using AWS Amplify.
## Philosophy
Moving to AWS from Google Analytics is a way to maintain your users' privacy. Our blog post, [Why you need to move off Google Analytics](https://dev.to/goatandsheep/stop-donating-your-customers-data-to-google-analytics-191), explains more about it.
Amplify requires a lot of boilerplate to be able to setup a useful Analytics setup quickly and effectively.
## Initialize your account
1. Create an AWS account
2. Create your Pinpoint account and Cognito Federated user pool
3. Add the following tag to your code (with your own values for `data-id-pool` and `data-pinpoint-id`):```html
```
## Click Events
> Based on [Amplify Page Event Tracking](https://docs.amplify.aws/lib/analytics/autotrack/q/platform/js#page-event-tracking)
Use `data-aws-analytics-` to indicate:
* `on`: event listening
* `name`: what will analytics event be named?
* `attrs`: any needed associated info```html
Continue
```If you need other events than `click`, open a ticket
## Custom events
> Based on [Amplify Analytics record](https://docs.amplify.aws/lib/analytics/record/q/platform/js).
```javascript
window.Amplify.Analytics.record({
name: 'albumVisit',
// Attribute values must be strings
attributes: { genre: '', artist: '' }
});
```## AWS Cloud setup
### IAM Role
Setup the Federated Cognito pool allowing unauth roles with the following permissions:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"mobiletargeting:PutEvents",
"mobiletargeting:UpdateEndpoint"
],
"Resource": "arn:aws:mobiletargeting:us-east-1::apps//*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"mobiletargeting:GetUserEndpoints",
"mobileanalytics:PutEvents"
],
"Resource": "*"
}
]
}
```CloudFormation coming soon...