{"id":25831246,"url":"https://github.com/arg0wak/google-opt-out","last_synced_at":"2025-06-22T06:34:37.754Z","repository":{"id":241594441,"uuid":"804890238","full_name":"arg0WAK/google-opt-out","owner":"arg0WAK","description":"Google Opt-out refers to a set of tools and settings that allow users to opt-out of certain data collection or tracking activities when using Google services.","archived":false,"fork":false,"pushed_at":"2024-05-28T16:11:51.000Z","size":84,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T00:42:55.284Z","etag":null,"topics":["analytics","cookie","cookie-consent","google","opt-out","tracking"],"latest_commit_sha":null,"homepage":"https://arg0wak.github.io/google-opt-out/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arg0WAK.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":"2024-05-23T13:20:20.000Z","updated_at":"2025-04-09T14:30:12.000Z","dependencies_parsed_at":"2024-05-29T07:30:11.365Z","dependency_job_id":null,"html_url":"https://github.com/arg0WAK/google-opt-out","commit_stats":null,"previous_names":["arg0wak/google-opt-out"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arg0WAK/google-opt-out","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arg0WAK%2Fgoogle-opt-out","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arg0WAK%2Fgoogle-opt-out/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arg0WAK%2Fgoogle-opt-out/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arg0WAK%2Fgoogle-opt-out/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arg0WAK","download_url":"https://codeload.github.com/arg0WAK/google-opt-out/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arg0WAK%2Fgoogle-opt-out/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261249020,"owners_count":23130489,"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":["analytics","cookie","cookie-consent","google","opt-out","tracking"],"created_at":"2025-02-28T20:33:14.328Z","updated_at":"2025-06-22T06:34:32.741Z","avatar_url":"https://github.com/arg0WAK.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cspan\u003e\n  \u003ca href=\"https://choosealicense.com/licenses/mit/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-green.svg\"/\u003e\n  \u003c/a\u003e\n\u003c/span\u003e\n\u003cbr/\u003e\n\u003cspan\u003e\u003ch1\u003eGoogle Opt-Out (Cookie Consent)\u003c/h1\u003e\u003c/span\u003e\u003cbr/\u003e\n\n![Google Opt-Out (Cookie Consent) Cover](https://arg0wak.github.io/gist/images/google-opt-out/2Q1NL3AAKQQUP8Z.png)\n\nGoogle Opt-out refers to a set of tools and settings that allow users to opt-out of certain data collection or tracking activities when using Google services. This is offered to users to enhance their privacy and help them avoid certain types of advertising or data collection. This repo gives the end user the option to refuse Analytics cookies. It supports both UA and GA4 properties.\n\n## ⛓️ Dependencies\n\nThe dependencies are given below. If you are using a SASS Compiler, you do not need to install the `sass` package.\n\n```bash\n  js-cookie\n  bootstrap\n  sass\n```\n\n## 🚨 Warnings\n\n### Add PUBLIC_KEY\n\nAdd your `PUBLIC KEY` to the field given in the example below.\nIf you have the Universal Analytics property, update the `G-` entry to `UA-`.\n\n`const PUBLIC_KEY = 'G-XXXXXXXXXX'`\n\n### Defining Necessary and Optional Cookies\n\nBefore starting the installation, determine what cookies are required in your project. Define the ones you want to remove optionally among these cookies in the `optionalCookies` variable.\n\n## 🚀 Installation\n\nFirst of all clone the repo to your device using the link below.\n\n```bash\n  $ git clone git@github.com:arg0WAK/google-opt-out.git\n  $ cd google-opt-out\n```\n\nInstall all dependencies.\n\n```bash\n  $ npm install\n  $ clear\n```\n\nDefine your public key given by Google Analytics in the `PUBLIC_KEY` variable between the `\u003chead\u003e\u003c/head\u003e` tags.\n\n```bash\n# Google tag (gtag.js) #\n\u003cscript\u003e\n   const PUBLIC_KEY = 'G-XXXXXXXXXX'\n\n   # Code is continuing.\n\u003c/script\u003e\n```\n\nImport `js.cookie.js` and `cookie.js` file just before the `\u003c/body\u003e` tags.\n\n```bash\n\u003cscript src=\"/node_modules/js-cookie/dist/js.cookie.js\"\u003e\u003c/script\u003e\n\n# arg0WAK Cookie.js JavaScript #\n\u003cscript src=\"js/cookie.js\"\u003e\u003c/script\u003e\n```\n\nImport dependencies in your SCSS or CSS like below.\n\n```bash\n# You don't need to use it in SCSS or CSS, you can define it as link in HTML if you want.\n@import url('/node_modules/bootstrap/dist/css/bootstrap.min.css');\n\n# Google Opt-Out Cookie Consent CSS\n@import url('cookie.css');\n@import url('utils/fixed.css');\n```\n\nGo back your HTML file and add code belows.\n\n```bash\n\u003cdiv class=\"cookie-container\"\u003e\n   \u003cdiv class=\"form-group p-3 d-flex flex-column justify-cent-center gap-2 rounded h-100\"\u003e\n      \u003cdiv class=\"form-check\"\u003e\n         \u003cinput\n            disabled\n            checked\n            class=\"form-check-input\"\n            type=\"checkbox\"\n            value=\"true\"\n            id=\"requiredCookies\" /\u003e\n         \u003clabel\n            class=\"form-check-label\"\n            for=\"\"\u003e\n            Required Cookies\n            # You must write function for only required Cookies #\n         \u003c/label\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"form-check\"\u003e\n         \u003cinput\n            class=\"form-check-input\"\n            type=\"checkbox\"\n            value=\"\"\n            id=\"analyticsCookies\" /\u003e\n         \u003clabel\n            class=\"form-check-label\"\n            for=\"analyticsCookies\"\u003e\n            Analytics Cookies\n         \u003c/label\u003e\n      \u003c/div\u003e\n      \u003cdiv class=\"form-group d-flex flex-column gap-2\"\u003e\n         \u003cbutton\n            class=\"btn btn-warning w-100\"\n            onclick=\"handleAllowCookie()\"\u003e\n            Accept Preferred Cookies 🔍\n         \u003c/button\u003e\n         \u003cdiv class=\"d-flex flex-md-row flex-column gap-2\"\u003e\n            \u003cbutton\n               class=\"btn btn-success w-100\"\n               onclick=\"allowAllCookies()\"\u003e\n               Accept All Cookies 🍪\n            \u003c/button\u003e\n            \u003cbutton\n               class=\"btn btn-danger w-100\"\n               onclick=\"handleDisableCookie()\"\u003e\n               Reject Cookies\n            \u003c/button\u003e\n         \u003c/div\u003e\n      \u003c/div\u003e\n   \u003c/div\u003e\n\u003c/div\u003e\n```\n\nIf you want to fix the Cookie Container over page, you can use the following classes.\n\n```bash\n\u003cdiv class=\"\n   cookie-container\n   cookie-container-fixed\n   cookie-container-center\"\u003e\n\n   # Code is continuing\n\u003c/div\u003e\n```\n\nAlso you can use `cookie-container-left` and `cookie-container-right` classes instead of `cookie-container` class.\n\n## Remove Optional Cookie\n\nWhen user rejects analytics data tracking permissions, user may want to reject other data tracking cookies. If you want to provide options to the user, you can customize the `optionalCookies` variable and manipulate the DOM as you wish through this structure.\n\n```bash\nconst optionalCookies = ['cookieName1', 'cookieName2', 'cookieName3']\n```\n\n_Enjoy it!_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farg0wak%2Fgoogle-opt-out","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farg0wak%2Fgoogle-opt-out","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farg0wak%2Fgoogle-opt-out/lists"}