consentify-migrate
v2.1.0
Published
Migrate to Consentify. Removes Cookiebot and tracking scripts, detects integrations, sets up your Consentify domains, and commits the changes. Works on a single project or a whole folder of client sites at once.
Maintainers
Readme
consentify-migrate
Set up Consentify across your projects in one command. The tool detects your framework, removes whatever consent tool you have today (Cookiebot, OneTrust, CookieYes, Iubenda, Usercentrics, and many more, or nothing at all) along with any tracking scripts, detects your existing integrations, creates your domain on Consentify, wires the script into the right place, and commits the changes to git.
It works on a single project, or on a whole folder of client sites at once (bulk mode), which is built for agencies and teams managing many websites.
# Single project (run from the project root)
npx consentify-migrate
# A whole folder of sites
npx consentify-migrate bulk ./clientsNo installation needed.
Before you start
You need a Consentify account. Create one at consentify.app. For bulk runs across many domains, make sure your plan has enough domain capacity.
Single project mode
Run the command from your project root. It walks you through:
- Detects your framework and the exact entry point to use for it.
- Finds your existing consent tool and tracking scripts in your source and removes them. It recognizes the common CMPs (Cookiebot, OneTrust, CookieYes, CookieFirst, Termly, Osano, Iubenda, Usercentrics, Didomi, TrustArc, Civic, Cookie Script, Klaro, Complianz, Borlabs, Quantcast, Sourcepoint, vanilla Cookie Consent). If the site has no CMP yet, it just sets Consentify up fresh. Trackers get re-injected by Consentify after consent.
- Detects integrations the same way the dashboard onboarding does: it runs Consentify's live GDPR scanner against your domain and picks up the tools we support (Google Analytics, Google Ads, GTM, Facebook Pixel, PostHog, TikTok, LinkedIn, Snapchat, HubSpot, Contentsquare, Intercom), including ones loaded through GTM. If the site isn't reachable, it falls back to scanning your source code. Every analytics/marketing tracker in your code is stripped so nothing fires before consent. Supported ones are set up on your domain; paid ones are only enabled if your plan includes them (otherwise the tool tells you which to upgrade for), and any tracker we don't have a built-in integration for (e.g. X/Twitter, Reddit, Clarity, Hotjar, Segment) is reported so you can re-add it as a custom integration. Payment and embed scripts (Stripe, PayPal, Klarna, reCAPTCHA, YouTube, Calendly) are left untouched.
- Finds your privacy policy by looking for a policy route in the project (
privacy,privacy-policy,personvern,cookies, and more, across languages), and useshttps://{domain}/{that-path}. - Logs you in to Consentify (credentials are used once and never stored).
- Creates your domain and configures the detected integrations via the API.
- Injects the Consentify script at the correct location for your framework.
- Commits the change to git (see git modes below).
Use --no-scan to skip the live scanner and rely on source-code detection only.
Bulk mode
Point the tool at a folder whose immediate subfolders are individual sites:
npx consentify-migrate bulk ./clientsclients/
acme.com/ → Next.js (App Router)
bergen-cafe/ → WordPress
nordic-shop.no/ → Vue
...For each project it detects the framework, resolves the domain, scans for integrations, sets up Consentify, strips trackers, injects the script, and commits + pushes on a dedicated branch. Failures on one project never stop the rest of the batch. At the end you get a consentify-migration-report.md (and .json) in the folder with every domain, token, and anything that needs manual follow-up.
Before it starts, the run checks your plan's domain capacity. If the folder has more sites than you have room for, it tells you up front and (with your confirmation) sets up as many as fit, rather than failing partway through. The rest are listed in the report as skipped for capacity.
Resolving domains
Each site needs a domain. The tool resolves it in this order:
- Manifest file (recommended for large batches), matched by folder name.
- Folder name, if the folder is itself a domain (e.g.
acme.com). - Git remote, if the repo name is a domain.
- Prompt, for anything still unresolved (unless
--yes).
Manifest as CSV:
folder,domain,policyUrl
acme-site,acme.com,https://acme.com/privacy
bergen-cafe,bergen-cafe.no,or JSON:
{ "acme-site": "acme.com", "bergen-cafe": "bergen-cafe.no" }npx consentify-migrate bulk ./clients --manifest ./domains.csv --yesGit modes
By default every project is committed on a dedicated consentify-setup branch and pushed, so nothing lands on main without review. Only the files the tool changed are staged, so any pre-existing uncommitted work is left alone.
| Flag | Behavior |
| ---------------- | --------------------------------------------------------------- |
| --git=branch | Create consentify-setup branch, commit, push (default). |
| --git=push | Commit on the current branch and push. |
| --git=commit | Commit only, no push. |
| --git=none | Make file changes only, no git. |
Options
| Flag | Description |
| --------------------------- | ---------------------------------------------------------------- |
| bulk [dir] / --all | Bulk mode over a folder of projects (default dir: cwd). |
| --manifest <file> | CSV or JSON folder to domain mapping. |
| --policy-pattern "<p>" | Fallback privacy policy URL if none detected, {domain} substituted. |
| --git=<mode> | Git behavior (see above). |
| --no-scan | Skip the live scanner; detect integrations from source only. |
| --dry-run | Detect and report only. No API calls, file writes, or git. |
| --yes / -y | Skip confirmation prompts (requires resolvable domains). |
Example, non-interactive agency run:
npx consentify-migrate bulk ./clients \
--manifest ./domains.csv \
--policy-pattern "https://{domain}/personvern" \
--git=branch --yesSupported frameworks
Each framework gets the script placed where it actually belongs, not just anywhere.
| Framework | Where the script goes |
| ---------------------- | ------------------------------------------------------- |
| Next.js (App Router) | Root layout <body> via next/script |
| Next.js (Pages Router) | pages/_document (created if missing) |
| React (CRA / Vite) | index.html before </body> |
| Vue | index.html before </head> |
| Nuxt | Generated client plugin using useHead |
| SvelteKit | src/app.html |
| Svelte (Vite) | index.html |
| Astro | Base layout <head> |
| Angular | src/index.html |
| WordPress | Theme header.php before wp_head() |
| Vanilla HTML | index.html before </body> |
Re-running is safe: if Consentify is already present in a project, it is skipped.
Supported integrations
Google Analytics, Google Tag Manager, Facebook Pixel, PostHog, TikTok Pixel, LinkedIn Insight Tag, Snapchat Pixel, HubSpot, Contentsquare, Intercom.
Integrations that are detected but whose ID could not be extracted are flagged in the report to configure manually in the dashboard.
After the migration
- Review the branch and file changes before merging.
- Customize your banners at consentify.app/dashboard/banner.
- Deploy and Consentify is live.
Requirements
- Node.js 18 or later
- Git (for commit/push modes)
- A Consentify account
