{"id":22737801,"url":"https://github.com/fourdigits/wagtail-cookie","last_synced_at":"2025-03-30T03:21:23.020Z","repository":{"id":147073632,"uuid":"141415615","full_name":"fourdigits/wagtail-cookie","owner":"fourdigits","description":"WIP","archived":false,"fork":false,"pushed_at":"2018-07-18T14:23:57.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-05T05:41:24.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/fourdigits.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.rst","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":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-18T09:52:39.000Z","updated_at":"2021-07-19T19:58:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"80301b60-0771-4986-97d9-cb8878878664","html_url":"https://github.com/fourdigits/wagtail-cookie","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/fourdigits%2Fwagtail-cookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourdigits%2Fwagtail-cookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourdigits%2Fwagtail-cookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourdigits%2Fwagtail-cookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fourdigits","download_url":"https://codeload.github.com/fourdigits/wagtail-cookie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246270802,"owners_count":20750465,"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-12-10T22:17:56.855Z","updated_at":"2025-03-30T03:21:23.014Z","avatar_url":"https://github.com/fourdigits.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Cookie\n======\n\nReusable Wagtail app to setup a cookie wall.\n\n\nInstall\n-------\n\n    pip install -e git+git ...#egg=cookie\n\n\nAdd 'cookie' AFTER your app. Also make sure 'django.contrib.sessions' is in installed apps:\n\n    INSTALLED_APPS = [\n        'your_app',\n        'cookie',\n        ...\n        'django.contrib.sessions'\n    ]\n\n\nMake sure the session backend is enabled.\n\n    MIDDLEWARE = [\n        ...\n        'django.contrib.sessions.middleware.SessionMiddleware',\n        ...\n    ]\n\n\nInclude cookie urls in your urls.py BEFORE wagtail urls:\n\n    from cookie import urls as cookie_urls\n\n    url_patterns = [\n        ...\n        url(r'', include(cookie_urls, namespace='cookie')),\n        url(r'', include(wagtail_urls)),\n    ]\n\n\nRegister the cookie settings in your wagtail_hooks.py:\n\n    from cookie.wagtail_hooks import AbstractCookie\n\n    @register_setting\n    class Cookie(AbstractCookie):\n        pass\n\n\nAdd the cookie template tag to your base template head section:\n\n    {% load cookie_tags %}\n\n    \u003cbody\u003e\n        ...\n        {% cookie_modal %}\n    \u003c/body\u003e\n\n\nWrap all template code that set third_party cookies in a `{% if request|third_party_cookies %}`:\n\n\n      {% if request|third_party_cookies %}\n        {% include_block self %}\n      {% else %}\n        \u003cp\u003e\u003ca href=\"{{ self.url }}\"\u003e{{ self.url }}\u003c/a\u003e\u003c/p\u003e\n        \u003cp\u003e\u003ca href=\"{% url 'cookie:cookie' %}\"\u003eSchakel third cookies in om embeds te zien.\u003c/a\u003e\u003c/p\u003e\n      {% endif %}\n\n\nWrap all template code that set analytical cookies in a `{% if request|analytical_cookies %}`:\n\n    {% if request|analytical_cookies %}\n      \u003cscript async src=\"https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-XX\"\u003e\u003c/script\u003e\n      \u003cscript\u003e\n        window.dataLayer = window.dataLayer || [];\n        function gtag(){dataLayer.push(arguments);}\n        gtag('js', new Date());\n        gtag('config', 'UA-XXXXXXX-XX');\n      \u003c/script\u003e\n    {% endif %}\n\n\nOverride templates\n------------------\n\nIf you want to customise the templates. Copy them to your own project:\n\n    $ cp cookie/templates/modal.html yourapp/templates/cookie/\n\n\n\nProduction\n----------\n\nAs users create new sessions on your website, session data can accumulate in your session store. The django_session\ndatabase table will grow and needs to be cleaned up from time to time.\n\nSetup a cronjob (Every day at 3AM) to run the clear sessions management command. Eg:\n\n    $ crontab -e\n\n    * 3 * * * cd /path/to/project \u0026\u0026 /path/to/python manage.py clearsessions --setttings=settings.production  \u003e/dev/null 2\u003e\u00261\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffourdigits%2Fwagtail-cookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffourdigits%2Fwagtail-cookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffourdigits%2Fwagtail-cookie/lists"}