{"id":20560352,"url":"https://github.com/andreaskoch/ga-spam-control","last_synced_at":"2026-03-01T07:31:18.466Z","repository":{"id":42420761,"uuid":"56802058","full_name":"andreaskoch/ga-spam-control","owner":"andreaskoch","description":"Command-line utility for blocking referrer spam from your Google Analytics accounts","archived":false,"fork":false,"pushed_at":"2016-06-28T20:09:59.000Z","size":9508,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2026-01-26T13:44:58.209Z","etag":null,"topics":["ga-spam-control","google-analytics","referrer-spam"],"latest_commit_sha":null,"homepage":"https://andykdocs.de/!ga-spam-control","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreaskoch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-21T20:00:01.000Z","updated_at":"2020-02-12T08:51:50.000Z","dependencies_parsed_at":"2022-09-26T18:51:22.136Z","dependency_job_id":null,"html_url":"https://github.com/andreaskoch/ga-spam-control","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/andreaskoch/ga-spam-control","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaskoch%2Fga-spam-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaskoch%2Fga-spam-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaskoch%2Fga-spam-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaskoch%2Fga-spam-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreaskoch","download_url":"https://codeload.github.com/andreaskoch/ga-spam-control/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaskoch%2Fga-spam-control/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29963707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T06:55:38.174Z","status":"ssl_error","status_checked_at":"2026-03-01T06:53:04.810Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ga-spam-control","google-analytics","referrer-spam"],"created_at":"2024-11-16T03:54:19.598Z","updated_at":"2026-03-01T07:31:18.448Z","avatar_url":"https://github.com/andreaskoch.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Analytics Spam Control\n\nCommand-line utility for automating the fight against Google Analytics referral spam\n\nGoogle Analytics [referrer spam](https://en.wikipedia.org/wiki/Referer_spam) is huge and never ending pain.\nThere are hundreds of known referrer spam domains and every other day a new one pops up. And the only way to keep the spammers from skewing your web analytics reports is to their stupid domain names – one by one.\n\n![ga-spam-control logo](files/assets/ga-spam-control-logo-300x200.png)\n\n**ga-spam-control** is a small command-line utility that keeps your Google Analytics spam filters up-to-date, automatically.\n\n## How does ga-spam-control work?\n\n**ga-spam-control** creates filters for your Google Analytics accounts that block known referrer spam domains from your analytics reports and keeps these filter up-to-date.\n\nTo always protect your analytics reports from annoying false entries ga-spam-control **combines multiple community-maintained lists** of known spam domains:\n\n- [ddofborgs' Analytics Ghost Spam List](https://github.com/ddofborg/analytics-ghost-spam-list)\n- [Stevie Rays'  apache-nginx-referral-spam-blacklist](https://github.com/Stevie-Ray/apache-nginx-referral-spam-blacklist)\n- [Piwik Referrer spam blacklist](https://github.com/piwik/referrer-spam-blacklist)\n\nThis gives you the ability to completely automate your spam protection process. Just let ga-spam-control check your Google Analytics accounts daily for new spam. And when it detects new spam; update your filters.\n\n## Available Commands\n\nThe command line utility provides the following actions.\n\n**Spam Control Filter Actions**\n\nIn order to protect your Google Analytics account from spam **ga-spam-control** creates filters which blocks known referrer spam domains from your analytics reports. These are the commands that help you to review and update your spam filters:\n\n- **filters status** displays the spam-control status of all your accounts or for a specific account\n- **filters update** creates or updates the spam-control filters for a specific account\n- **filters remove** removes all previously created spam-control filters from an account\n\n**Referrer Spam Domains Actions**\n\nThe basis for the spam filters is an up-to-date list of known referrer spam domains. And with these commands you can review and update the spam-domain lists:\n\n- **domains list** prints a list of all currently known referrer spam domains\n- **domains update** downloads the latest referrer spam domain name lists and updates your local list of known referrer spam domains\n- **domains find** allows you to manually review the last `n` days of analytics data and mark domain names as spam\n\nWhich domains are currently considered spam is stored in the `~/.ga-spam-control/spam-domains/community.txt` and `~/.ga-spam-control/spam-domains/personal.txt`.\n\n## Using ga-spam-control\n\n```bash\nga-spam-control \u003ccommand\u003e [\u003cargs\u003e ...]\n```\n\n### Help\n\nPrint information about the available actions:\n\n```bash\nga-spam-control help\n```\n\nPrint detailed help information about the different arguments and flags of a specific action:\n\n```bash\nga-spam-control help \u003cactionname\u003e\n```\n\n### Authorizing ga-spam-control to access your Google Analytics accounts\n\nThe first time you perform an action, you will be displayed an oAuth authorization dialog.\nIf you permit the requested rights the authentication token will be stored in your home directory (`~/.ga-spam-control/credentials.json`).\n\n![Animation: Authorizing ga-spam-control to access your Google Analytics accounts](files/usage/02-authorize.gif)\n\nTo sign out you can either delete the file or de-authorize the \"Google Analytics Spam Control\" app in your Google App Permissions at https://security.google.com/settings/security/permissions.\n\n### Get your spam-Control status\n\nDisplay the current spam-control **status** for all accounts that you have access to:\n\n```bash\nga-spam-control filters status\n```\n\nDisplay the spam-control status in a parseable format:\n\n```bash\nga-spam-control filters status --quiet\n```\n\nDisplay the current spam-control **status** for a specific Google Analytics account:\n\n```bash\nga-spam-control filters status \u003caccountID\u003e\n```\n\n![Animation: Displaying your current spam-control status with ga-spam-control filters status](files/usage/03-filters-status.gif)\n\n### Install or update filters\n\nCreate or update the spam-control filters of a given Google Analytics account:\n\n```bash\nga-spam-control filters update \u003caccountID\u003e\n```\n\n![Animation: Installing or updating spam-control filters using ga-spam-control filters update](files/usage/04-filters-update.gif)\n\n### Uninstall filters\n\nRemove the spam-control filters of a given Google Analytics account:\n\n```bash\nga-spam-control filters remove \u003caccountID\u003e\n```\n\nThis will simply remove all filters that ga-spam-control created earlier.\n\n### List all known spam domains\n\nPrint a list of your known referrer spam domains names (community \u0026 personal):\n\n```bash\nga-spam-control domains list\n```\n\n![Animation: Displaying a list of all known referrer spam domain names with ga-spam-control domains list](files/usage/05-domains-list.gif)\n\n### Update your list of known spam domains\n\nUpdate your local community list of known referrer spam domain names:\n\n```bash\nga-spam-control domains update\n```\n\n![Animation: Downloading the latest referrer spam domain names with ga-spam-control domains update](files/usage/06-domains-update.gif)\n\n### Find new spam domains\n\nFind referrer spam domain names in your Google Analtics data. Review the hostnames of the last `n` days of one of your Google Analytics accounts and mark those which you consider spam. All marked domain names will be added to your personal referrer spam list:\n\n```bash\nga-spam-control domains find \u003caccountID\u003e \u003cnumberOfDaysToLookBack\u003e\n```\n\n![Animation: Locating new referrer spam domain names in your Google Analytics reports with ga-spam-control domains find](files/usage/07-domains-find.gif)\n\nBy default ga-spam-control will use the last 90 days of analytics data. But if you want to review less or more days you can specify the number of days yourself.\n\n## Installation\n\nThe command-line package is [github.com/andreaskoch/ga-spam-control/cli](cli/main.go). You can clone the repository or install it with `go get github.com/andreaskoch/ga-spam-control` and then run the [make.go](make.go) script:\n\n```bash\ngo run make.go -test\ngo run make.go -install\ngo run make.go -crosscompile\n```\n\nOr with **make**:\n\n```\nmake test\nmake install\nmake crosscompile\n```\n\n## Licensing\n\nga-spam-control is licensed under the Apache License, Version 2.0.\nSee [LICENSE](LICENSE) for the full license text.\n\n## Roadmap\n\nIdeally Google would just include a spam-protection into Google Analytics but until then here are some ideas for additional features and possible improvements:\n\n- Make remote spam domain providers configurable\n- Publish spam domain names that you found in your Google Analytics accounts back to the community lists.\n- Populate my own list of known referrer spam domains with the results from the `find-spam-domains` action.\n  - Automatic daily upload from the ga-spam-control clients\n  - Review of the additions by trusted community members or by a tool which checks the listed website\n- Create and update a \"No Referrer Spam\" segment and update it during the normal update process.\nUnfortunately I will need Google to add create and update support to the Google Analytics API for this to work (see: [analytics-issues - Issue 174: Create Advanced Segment and Customized Report Through API](https://code.google.com/p/analytics-issues/issues/detail?id=174)).\n- Until Google supports segment creation via the API I ga-spam-control can at least print the necessary segment content to support manual editing of spam segments.\n- Use machine learning to automatically identify new referrer spam.\nEarlier versions of ga-spam-control already used a machine learning model. But unfortunately I could only train the model to detect new referrer spam for a single website - the model did not work well enough when I applied it to websites with different usage patterns.\n- Other options for detecting referrer spam automatically\n  - Correlate analytics data with web server logs to identify referrer spam\n  - Do a word analysis of the referrer site and use regular e-mail techniques to identify spam sites\n\nLet me know if you have other ideas, or if want one of the features implemented next.\n\n## Related Resources\n\n### Referrer Spam\n\n- [What is referrer spam?](https://en.wikipedia.org/wiki/Referer_spam)\n- [Google Analytics Help Forum - Referral Spam Traffic](https://www.en.advertisercommunity.com/t5/Referral-Spam-Traffic/bd-p/Referral_Spam_Traffic)\n\n### Lists of Referrer Spam Domains\n\nThere are multiple curated lists of referrer spam domains out there that you can use to create filters for your analytics accounts.\n\n- [Analytics Ghost Spam List](https://github.com/ddofborg/analytics-ghost-spam-list)\n- [Stevie Ray: apache-nginx-referral-spam-blacklist](https://github.com/Stevie-Ray/apache-nginx-referral-spam-blacklist)\n- [Piwik Referrer spam blacklist](https://github.com/piwik/referrer-spam-blacklist)\n- [Referrer Spam Blocker Blacklist](https://referrerspamblocker.com/blacklist)\n- [My own list of referral spam domains](spam-domains/referrer-spam-domains.txt)\n\n### Other Spam Blocker Tools\n\nga-spam-control is not the first and not the only tool that helps you to block referrer spam from your Google Analytics accounts.\n\n- [Online Tool: Analytics Referrer/Ghost Spam Blocker](https://www.adwordsrobot.com/en/tools/ga-referrer-spam-killer)\n- [Spam Filter Installer](http://www.simoahava.com/spamfilter/)\n- [Referrer Spam Blocker](https://referrerspamblocker.com/)\n\n### Google Analytics: Segments\n\nFilters **prevent** referrer spam from getting into your Google Analytics accounts.\nBut filters don't help you with referrer spam that already reached your reports. In order to filter this spam out you can use segments that filter out the spammy traffic:\n\n- [Analytics Spam Blocker ](https://www.google.com/analytics/gallery/#posts/search/%3F_.tab%3DMy%26_.sort%3DDATE%26_.start%3D0%26_.viewId%3DgyNgK6N3R6iK-UphdU8M6w/)\n\n### Google Analytics: Bot and Spider Filtering\n\nGoogle Analytics has a setting to block bots and spiders from your Google Analytics reports.\n\n1. Goto `Google Analytics \u003e Admin \u003e Account \u003e Property \u003e View \u003e View Settings`\n2. Goto `Bot Filtering`\n3. Check `Exclude all hits from known bots and spiders`\n\nThis feature is not advertised much by Google. The only time it officially got mentioned by is in a Google Plus post: [Google Analytics - Introducing Bot and Spider Filtering](https://plus.google.com/+GoogleAnalytics/posts/2tJ79CkfnZk).\n\nI am not yet sure if this flag does the trick. One would assume that is would be easy for Google to exclude all referrer spam and block the stupid spammers once and for all.\n\n### Google Analytics: API\n\n- [Google Analytics Account API](https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/accounts/list)\n- [Google Analytics Filter API](https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/filters)\n- [Google Analytics Filter Expressions](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters)\n- [Google Analytics Data Management](https://developers.google.com/analytics/devguides/config/mgmt/v3/data-management)\n- [Google Analytics Profile Filter Links](https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/profileFilterLinks)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaskoch%2Fga-spam-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreaskoch%2Fga-spam-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaskoch%2Fga-spam-control/lists"}