{"id":15539415,"url":"https://github.com/greatwizard/ember-tarteaucitron","last_synced_at":"2025-08-19T15:04:03.985Z","repository":{"id":57224403,"uuid":"453703230","full_name":"GreatWizard/ember-tarteaucitron","owner":"GreatWizard","description":"Ember integration of tarteaucitron.js, a RGPD friendly cookie manager.","archived":false,"fork":false,"pushed_at":"2022-02-02T17:08:25.000Z","size":221,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-06T11:42:30.776Z","etag":null,"topics":["cookie","ember-addon","gdpr","law","rgpd","tarteaucitron","tarteaucitronjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/GreatWizard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-30T14:31:10.000Z","updated_at":"2022-01-31T11:37:59.000Z","dependencies_parsed_at":"2022-09-04T07:01:25.273Z","dependency_job_id":null,"html_url":"https://github.com/GreatWizard/ember-tarteaucitron","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/GreatWizard/ember-tarteaucitron","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fember-tarteaucitron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fember-tarteaucitron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fember-tarteaucitron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fember-tarteaucitron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GreatWizard","download_url":"https://codeload.github.com/GreatWizard/ember-tarteaucitron/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatWizard%2Fember-tarteaucitron/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271173053,"owners_count":24711663,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cookie","ember-addon","gdpr","law","rgpd","tarteaucitron","tarteaucitronjs"],"created_at":"2024-10-02T12:10:22.881Z","updated_at":"2025-08-19T15:04:03.955Z","avatar_url":"https://github.com/GreatWizard.png","language":"JavaScript","funding_links":["https://liberapay.com/GreatWizard/"],"categories":[],"sub_categories":[],"readme":"# ember-tarteaucitron\n\n[![CI](https://github.com/GreatWizard/ember-tarteaucitron/actions/workflows/ci.yml/badge.svg)](https://github.com/GreatWizard/ember-tarteaucitron/actions/workflows/ci.yml)\n[![Ember Observer Score](https://emberobserver.com/badges/ember-tarteaucitron.svg)](https://emberobserver.com/addons/ember-tarteaucitron)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Liberapay](https://img.shields.io/liberapay/patrons/GreatWizard.svg?logo=liberapay)](https://liberapay.com/GreatWizard/)\n\nEmber integration of [tarteaucitron.js](https://github.com/AmauriC/tarteaucitron.js), a RGPD friendly cookie manager.\n\n## Compatibility\n\n- Ember.js v3.24 or above\n- Ember CLI v3.24 or above\n- Node.js v12 or above\n\n## Installation\n\n```\nember install ember-tarteaucitron\n```\n\n## Usage\n\nAll your tarteaucitron configuration is stored inside your `config/environement.js` as follow:\n\n```js\nmodule.exports = function (environment) {\n  let ENV = {\n\n    [...]\n\n    tarteaucitron: {\n      customServices: [], // You can define your own services directly here, see https://github.com/AmauriC/tarteaucitron.js#create-custom-service\n      preInit: { // Change some settings before the initialization of tarteaucitron.js\n        tarteaucitronForceCDN: \"https://...\", // Define where the tarteaucitron assets are available, default to \u003cyour-app\u003e/assets/tarteaucitron/\n        tarteaucitronForceLanguage: 'en', // Force the display language (default to the current browser language)\n        tarteaucitronForceExpire: 365 * 10, // Force the expire cookie time (default to 365)\n        tarteaucitronCustomText: { // Change a translation, see https://github.com/AmauriC/tarteaucitron.js#customize-text\n          'support': {\n            'title': 'Support client',\n          },\n          'close': 'Enregistrer et fermer',\n          'engage-twitter': 'Suivez-nous sur Twitter !',\n        },\n      },\n      config: {}, // tarteaucitron init configuration, see https://github.com/AmauriC/tarteaucitron.js#how-to-use\n      jobs: ['googlefonts'], // Services name to activate\n      user: { // Configuration used by services\n        googleFonts: ['Tangerine'], // Configuration for googlefonts\n      },\n    },\n  }\n\n  [...]\n\n  return ENV\n}\n```\n\nIf you need to deactivate `ember-tarteaucitron`, you can configure on your `ember-cli-build.js` file as follow:\n\n```js\nconst EmberAddon = require('ember-cli/lib/broccoli/ember-addon')\n\nmodule.exports = function (defaults) {\n  let app = new EmberAddon(defaults, {\n    'ember-tarteaucitron': {\n      enabled: false, // Enabled by default\n    },\n  })\n\n  [...]\n}\n```\n\n### CDN\n\nHere is the configuration if you want to use CDN for tarteaucitron assets:\n\n```js\nmodule.exports = function (environment) {\n  let ENV = {\n\n    [...]\n\n    tarteaucitron: {\n      preInit: {\n        tarteaucitronForceCDN: 'https://cdn.jsdelivr.net/npm/tarteaucitronjs@latest/',\n      },\n      [...]\n    },\n  }\n\n  [...]\n\n  return ENV\n}\n```\n\nAnd you can avoid to import tarteaucitron assets:\n\n```js\nconst EmberAddon = require('ember-cli/lib/broccoli/ember-addon')\n\nmodule.exports = function (defaults) {\n  let app = new EmberAddon(defaults, {\n    'ember-tarteaucitron': {\n      importAssets: false,\n    },\n  })\n\n  [...]\n}\n```\n\n### API\n\nThe `tarteaucitron` service exposes functions in order to add new jobs programmatically and listen to events.\n\n#### Setup a new job\n\n- `addJob(name, config)`: Add a new job with configuration\n\n#### Service events\n\n- `addServiceAddedListener(name, callback)`: listener called when a service is added\n- `removeServiceAddedListener(name, callback)`: remove the listener when a service is added\n- `addServiceLoadedListener(name, callback)`: listener called when a service is loaded\n- `removeServiceLoadedListener(name, callback)`: remove the listener when a service is loaded\n\nThe service names are defined in `tarteaucitron`: https://github.com/AmauriC/tarteaucitron.js/blob/master/tarteaucitron.services.js\n\n#### Tarteaucitron events\n\n- `addTACListener(name, callback)`: listener when an event occurred\n- `removeTACListener(name, callback)`: remove listener when an event occurred\n\nThe following events are available:\n\n- **tac.root_available**: the root element with panel has been created, services will be loaded\n- **tac.open_alert**: the alert is opened\n- **tac.close_alert**: the alert is closed\n- **tac.open_panel**: the panel is opened\n- **tac.close_panel**: the panel is closed\n\n##### Code example\n\n```js\nimport Controller from '@ember/controller'\nimport { service } from '@ember/service'\nimport { tracked } from '@glimmer/tracking'\n\nexport default class ApplicationController extends Controller {\n  @service tarteaucitron\n\n  @tracked googlefontsLoaded = false\n  @tracked facebookpixelLoaded = false\n\n  constructor() {\n    super(...arguments)\n    this.tarteaucitron.addServiceLoadedListener('googlefonts', () =\u003e {\n      this.googlefontsLoaded = true\n      this.tarteaucitron.removeServiceLoadedListener('googlefonts')\n    })\n    this.tarteaucitron.addServiceLoadedListener('facebookpixel', () =\u003e {\n      this.facebookpixelLoaded = true\n      this.tarteaucitron.removeServiceLoadedListener('facebookpixel')\n    })\n    setTimeout(() =\u003e {\n      this.tarteaucitron.addJob('facebookpixel', { facebookpixelId: 'YOUR-ID' })\n    }, 5000)\n  }\n}\n```\n\n## Contributing\n\nSee the [Contributing](CONTRIBUTING.md) guide for details.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreatwizard%2Fember-tarteaucitron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreatwizard%2Fember-tarteaucitron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreatwizard%2Fember-tarteaucitron/lists"}