{"id":17026428,"url":"https://github.com/zapthedingbat/gpt-consent","last_synced_at":"2025-03-22T19:16:11.266Z","repository":{"id":57252795,"uuid":"167168811","full_name":"zapthedingbat/gpt-consent","owner":"zapthedingbat","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-15T08:55:11.000Z","size":6,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T03:02:25.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zapthedingbat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-01-23T11:04:49.000Z","updated_at":"2019-01-23T11:17:50.000Z","dependencies_parsed_at":"2024-10-14T07:32:49.527Z","dependency_job_id":"f292d1d5-a68b-418b-8bcb-bc36aa124280","html_url":"https://github.com/zapthedingbat/gpt-consent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fgpt-consent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fgpt-consent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fgpt-consent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zapthedingbat%2Fgpt-consent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zapthedingbat","download_url":"https://codeload.github.com/zapthedingbat/gpt-consent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245007239,"owners_count":20546143,"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":[],"created_at":"2024-10-14T07:32:41.492Z","updated_at":"2025-03-22T19:16:11.233Z","avatar_url":"https://github.com/zapthedingbat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GPT Consent Collection\nMinimal consent collection script to meet Google Ad network consent collection requirements.\n\n## Consent collection flow\nhttps://support.google.com/admanager/answer/9031024?hl=en\u0026ref_topic=9007190\n\n- Defer Ad Loading - disableInitialLoad\n- Check the cookie for existing consent.\n  - If consent is granted\n    - enable personalisation\n    - load ads\n- If consent is explicitly denied\n  - disable personalization\n  - load ads\n- If no consent signal is set\n  - prompt for consent.\n- When prompt is completed\n  - Drop consent signal cookie\n  - If consent is granted\n    - enable personalisation\n    - load ads\n- If consent is explicitly denied\n  - disable personalization\n  - load ads\n\n## Usage\nInclude the script tag somewhere within the page.\n\n```html\n\u003cscript src=\"//unpkg.com/gpt-consent@latest/dist/g.js\"\u003e\u003c/script\u003e\n```\n\nInclude an overlay element with the id `consentOverlay` somewhere within the page that will be displayed to users that have not provided consent. This must include elements with the `data-consent-action=\"opt-in\"` and `data-consent-action=\"opt-out\"` attributes that are used to handle the users choice and close the prompt.\n\n```html\n\u003cdiv id=\"consentOverlay\" style=\"display:none\"\u003e\n  \u003cdiv class=\"prompt\"\u003e\n    \u003ch1\u003eCan we use your data to tailor ads for you?\u003c/h1\u003e\n    \u003cp\u003e\n      Our partners will collect data and use cookies for ad personalization and measurement. \u003ca href=\"/privacy\" target=\"_blank\"\u003eLearn how\u003c/a\u003e we and our partners collect and use data\n    \u003c/p\u003e\n    \u003cbutton data-consent-action=\"opt-in\"\u003eYes\u003cbutton\u003e\n    \u003cbutton data-consent-action=\"opt-out\"\u003eNo\u003cbutton\u003e\n    You can change your choice at any time.\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\nInclude a button (or any clickable element) to re-display the prompt somewhere on the site. Any element with the 'data-consent-action=\"choose\"' attribute set will have the click handler attached.\n\n```html\n\u003cdiv class=\"footer\"\u003e\n  \u003cspan data-consent-action=\"choose\"\u003eChange your ad personalization choice.\u003c/span\u003e\n\u003c/div\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzapthedingbat%2Fgpt-consent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzapthedingbat%2Fgpt-consent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzapthedingbat%2Fgpt-consent/lists"}