{"_id":"@tribusdigital/emdash-tracking-scripts","_rev":"3-8017ae50d90dba6c61094e7ee6a6c061","name":"@tribusdigital/emdash-tracking-scripts","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.0-stage":{"name":"@tribusdigital/emdash-tracking-scripts","version":"0.0.0-stage","_id":"@tribusdigital/emdash-tracking-scripts@0.0.0-stage","stub":true,"maintainers":[{"name":"shennyy","email":"shane.muirhead@tribusdigital.com"}],"dist":{"shasum":"f15b795fbfce9b0988cff8e0b23eced0e759117a","tarball":"https://registry.npmjs.org/@tribusdigital/emdash-tracking-scripts/-/emdash-tracking-scripts-0.0.0-stage.tgz","fileCount":2,"integrity":"sha512-75X9YjUD/ChOC7gm7utoLtm4MuGysFtYM5vQRFe68/WHKKjhd4UTe2JdOgPQl2SNA5HjMSBBlq86xk2zuOyJMQ==","signatures":[{"sig":"MEUCIQCvGkfuMAQgyMVQuZ6VCXwdhsztCMWMty++RU+ZNG+kSwIgZdGDPD4nDF85iHJi7V40p7H9ieAlh+PnOTpgEESo/Gc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":360},"_npmUser":{"name":"shennyy","email":"shane.muirhead@tribusdigital.com"},"description":"Temporary package placeholder for staged publishing","directories":{}},"0.1.0":{"_id":"@tribusdigital/emdash-tracking-scripts@0.1.0","bugs":{"url":"https://github.com/ShaneMuir/emdash-tracking-scripts/issues"},"dist":{"shasum":"720b7b5240ae0b367893afafbb4986883b6ed209","tarball":"https://registry.npmjs.org/@tribusdigital/emdash-tracking-scripts/-/emdash-tracking-scripts-0.1.0.tgz","fileCount":4,"integrity":"sha512-XizLvkaFHOVLXDlUmBTac7/gkpuCE8Mis1al+2ios3DR/jUg9aKTtu7rL/++/CGtRHNQmTazAWuP6Tam5IvLpA==","signatures":[{"sig":"MEQCICb7W2st9upFf2hU45e70BqVMCeW7VlbD6Eo/CoFySiLAiBFrha8cmpvOyvV2Xg+05DKMxzqhjQoyeufx2GIdgTm9Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFGvSeMGL4TQNbnzve3SdSC9QOP4d3jl7Z/+8rV7/5H9AiBS4U16/QErhuB9x7aa2TS7CoqyF6lDjFGpoxaq2RQS7g=="}],"unpackedSize":12708},"name":"@tribusdigital/emdash-tracking-scripts","type":"module","author":{"name":"Shane Muirhead","email":"shane.muirhead@tribusdigital.com"},"exports":{".":"./index.mjs"},"gitHead":"2a7632bc8de0ffa7f502913f87e211c9eb4a3e49","license":"MIT","scripts":{"test":"vitest run"},"version":"0.1.0","_npmUser":{"name":"shennyy","email":"shane.muirhead@tribusdigital.com"},"homepage":"https://github.com/ShaneMuir/emdash-tracking-scripts#readme","keywords":["emdash","emdash-plugin","google-tag-manager","google-analytics","gtag","analytics","tracking"],"repository":{"url":"git+https://github.com/ShaneMuir/emdash-tracking-scripts.git","type":"git"},"_npmVersion":"10.2.3","description":"Native EmDash plugin for injecting third-party tracking and analytics scripts (Google Tag Manager, GA4/gtag, Lead Forensics, and custom snippets) site-wide, with an admin-configurable settings screen.","directories":{},"maintainers":[{"name":"josh-tribus","email":"josh@tribusdigital.com"},{"name":"mspilsbury","email":"mark@tribusdigital.com"},{"name":"shennyy","email":"shane.muirhead@tribusdigital.com"}],"_nodeVersion":"18.19.0","contributors":[],"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"emdash":"^1.0.1","vitest":"^3.0.0"},"peerDependencies":{"emdash":"^1.0.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emdash-tracking-scripts_0.1.0_1790778288075_0.005393029348750522"}}},"time":{"created":"2026-09-30T14:20:39.515Z","modified":"2026-09-30T14:24:48.313Z","0.0.0-stage":"2026-09-30T14:20:39.515Z","0.1.0":"2026-09-30T14:24:48.163Z"},"description":"Native EmDash plugin for injecting third-party tracking and analytics scripts (Google Tag Manager, GA4/gtag, Lead Forensics, and custom snippets) site-wide, with an admin-configurable settings screen.","maintainers":[{"name":"josh-tribus","email":"josh@tribusdigital.com"},{"name":"mspilsbury","email":"mark@tribusdigital.com"},{"name":"shennyy","email":"shane.muirhead@tribusdigital.com"}],"readme":"# @tribusdigital/emdash-tracking-scripts\n\n[![CI](https://github.com/ShaneMuir/emdash-tracking-scripts/actions/workflows/ci.yml/badge.svg)](https://github.com/ShaneMuir/emdash-tracking-scripts/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)\n[![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./CONTRIBUTING.md)\n\nA native [EmDash CMS](https://emdashcms.com) plugin that injects third-party tracking and analytics scripts — Google Tag Manager, GA4/gtag, Lead Forensics, and any other raw snippet — site-wide, with an admin-configurable settings screen so a non-technical SEO user can manage tracking IDs without a developer or a deploy.\n\n## Why a native plugin, not a registry install\n\nRaw `<script>` injection into `<head>`/`<body>` is only available through EmDash's `page:fragments` hook, which is **trusted-only** and explicitly excluded from the sandboxed plugin registry. This package must be installed as a normal npm dependency of your site and wired into `astro.config.mjs` — it cannot be installed from inside the CMS admin's plugin browser.\n\n## Install\n\n```sh\nnpm install @tribusdigital/emdash-tracking-scripts\n```\n\n```js\n// astro.config.mjs\nimport { trackingScriptsPlugin } from '@tribusdigital/emdash-tracking-scripts';\nimport emdash from 'emdash/astro';\n\nexport default defineConfig({\n\tintegrations: [\n\t\temdash({\n\t\t\tplugins: [trackingScriptsPlugin()],\n\t\t\t// ...your existing database/storage config\n\t\t}),\n\t],\n});\n```\n\nYour site's layout must already render `<EmDashHead>`, `<EmDashBodyStart>`, and `<EmDashBodyEnd>` from `emdash/ui` (this is the standard EmDash site setup) — the plugin's fragments render through those.\n\n## Configure\n\nOnce installed and deployed, an **Analytics & Tracking** settings screen appears in the EmDash admin (auto-generated from the plugin's settings schema — no extra admin code to build or maintain). Available fields:\n\n| Field | What it does |\n| --- | --- |\n| **Enabled** | Master on/off switch for every tracking script on the site. |\n| **Google Tag Manager Container ID** | e.g. `GTM-XXXXXXX`. Adds the standard GTM `<script>` in `<head>` and the `<noscript>` fallback at the start of `<body>`. |\n| **Google Analytics 4 Measurement ID** | e.g. `G-XXXXXXXXXX`. Only needed if loading GA4 directly rather than through GTM. Adds `gtag.js` plus the init snippet. |\n| **Lead Forensics tracking snippet** | Paste the full `<script>` snippet from your Lead Forensics account as-is. Rendered near the end of `<body>`. |\n| **Custom `<head>` snippet** | Any other raw HTML/script for `<head>` on every page. |\n| **Custom end-of-`<body>` snippet** | Any other raw HTML/script just before `</body>` on every page. |\n\nValues are stored via EmDash's plugin settings API and take effect immediately — no rebuild or redeploy needed to change a tracking ID.\n\nGTM and GA4 IDs are validated against their expected format (`GTM-...` / `G-...`) before being used; anything that doesn't match is silently skipped rather than emitted as a broken script tag. The Lead Forensics and custom snippet fields are rendered verbatim — they're plugin settings editable only by whoever has admin/plugin-settings access in your CMS, the same trust level as WordPress's \"insert headers and footers\" style plugins.\n\n## Development\n\n```sh\nnpm install\nnpm test\n```\n\n`index.mjs` separates the pure fragment-building logic (`buildFragments`, `resolveSettings`) from the `definePlugin()` wiring, so the tracking-tag output is fully unit tested without needing a running EmDash instance.\n\n## Contributing\n\nThis plugin is deliberately kept small, dependency-free, and thoroughly tested so it stays trustworthy as trusted-authority code — that's also what makes it a good base to build on rather than reinvent. If it's missing an integration you need (a platform, a consent-mode toggle, per-page opt-out, etc.), we'd much rather have that as a PR here than see a dozen narrower forks. See [CONTRIBUTING.md](./CONTRIBUTING.md) for the ground rules, and [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) for how we expect people to treat each other while doing it. Issues and PRs welcome.\n\n## License\n\nMIT — see [LICENSE](./LICENSE). Free to use, fork, and build on.\n","readmeFilename":"README.md","homepage":"https://github.com/ShaneMuir/emdash-tracking-scripts#readme","keywords":["emdash","emdash-plugin","google-tag-manager","google-analytics","gtag","analytics","tracking"],"repository":{"url":"git+https://github.com/ShaneMuir/emdash-tracking-scripts.git","type":"git"},"contributors":[],"author":{"name":"Shane Muirhead","email":"shane.muirhead@tribusdigital.com"},"bugs":{"url":"https://github.com/ShaneMuir/emdash-tracking-scripts/issues"},"license":"MIT"}