{"id":13630392,"url":"https://github.com/goatandsheep/aws-web-analytics","last_synced_at":"2025-03-15T11:32:15.324Z","repository":{"id":37820922,"uuid":"234238873","full_name":"goatandsheep/aws-web-analytics","owner":"goatandsheep","description":"Privacy-focused alternative to Google Analytics on AWS Pinpoint","archived":false,"fork":false,"pushed_at":"2024-10-10T17:52:08.000Z","size":1007,"stargazers_count":48,"open_issues_count":54,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-11T22:09:11.731Z","etag":null,"topics":["amplify-js","analytics","aws","google-analytics","help-wanted"],"latest_commit_sha":null,"homepage":"https://console.aws.amazon.com/pinpoint/home","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goatandsheep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-16T04:59:37.000Z","updated_at":"2024-08-08T21:46:10.000Z","dependencies_parsed_at":"2023-10-16T18:55:38.457Z","dependency_job_id":"34095031-36cc-4112-a8ed-f7062643be20","html_url":"https://github.com/goatandsheep/aws-web-analytics","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goatandsheep%2Faws-web-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goatandsheep%2Faws-web-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goatandsheep%2Faws-web-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goatandsheep%2Faws-web-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goatandsheep","download_url":"https://codeload.github.com/goatandsheep/aws-web-analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221573148,"owners_count":16845775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amplify-js","analytics","aws","google-analytics","help-wanted"],"created_at":"2024-08-01T22:01:41.082Z","updated_at":"2024-10-26T19:39:27.279Z","avatar_url":"https://github.com/goatandsheep.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# AWS Web Analytics\n\nTracking tag library for AWS Pinpoint as an alternative to Google Analytics using AWS Amplify. \n\n## Philosophy\n\nMoving 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.\n\nAmplify requires a lot of boilerplate to be able to setup a useful Analytics setup quickly and effectively.\n\n## Initialize your account\n\n1. Create an AWS account\n2. Create your Pinpoint account and Cognito Federated user pool\n3. Add the following tag to your code (with your own values for `data-id-pool` and `data-pinpoint-id`):\n\n```html\n\u003cscript\n    data-id-pool=\"us-east-1:abcd1234-abcd-1234-5678-abcd12345678\"\n    data-pinpoint-id=\"1234abcd5678abcd7890abcd1234\"\n    id=\"aws-web-analytics\"\n    src=\"https://goatandsheep.github.io/aws-web-analytics/dist/aws-web-analytics.js\"\n    type=\"text/javascript\"\n\u003e\u003c/script\u003e\n```\n\n## Click Events\n\n\u003e Based on [Amplify Page Event Tracking](https://docs.amplify.aws/lib/analytics/autotrack/q/platform/js#page-event-tracking)\n\nUse `data-aws-analytics-` to indicate:\n\n* `on`: event listening\n* `name`: what will analytics event be named?\n* `attrs`: any needed associated info\n\n```html\n\u003c!-- you want to track this button and send an event when it is clicked --\u003e\n\u003cbutton\n    data-aws-analytics-on=\"click\"\n    data-aws-analytics-name=\"submitButtonClick\"\n    data-aws-analytics-attrs=\"attr1:attr1_value,attr2:attr2_value\"\n\u003eContinue\u003c/button\u003e\n```\n\nIf you need other events than `click`, open a ticket \n\n## Custom events\n\n\u003e Based on [Amplify Analytics record](https://docs.amplify.aws/lib/analytics/record/q/platform/js).\n\n```javascript\nwindow.Amplify.Analytics.record({\n    name: 'albumVisit', \n    // Attribute values must be strings\n    attributes: { genre: '', artist: '' }\n});\n```\n\n## AWS Cloud setup\n\n### IAM Role\n\nSetup the Federated Cognito pool allowing unauth roles with the following permissions:\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"VisualEditor0\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"mobiletargeting:PutEvents\",\n                \"mobiletargeting:UpdateEndpoint\"\n            ],\n            \"Resource\": \"arn:aws:mobiletargeting:us-east-1:\u003caccount-number\u003e:apps/\u003cpinpoint-project-id\u003e/*\"\n        },\n        {\n            \"Sid\": \"VisualEditor1\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"mobiletargeting:GetUserEndpoints\",\n                \"mobileanalytics:PutEvents\"\n            ],\n            \"Resource\": \"*\"\n        }\n    ]\n}\n```\n\nCloudFormation coming soon...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoatandsheep%2Faws-web-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoatandsheep%2Faws-web-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoatandsheep%2Faws-web-analytics/lists"}