DataGoat's tracker uses the same script tag and attributes as DataFast, and its window.datagoat()
API also answers to window.datafast(), so every DataFast installation method works with DataGoat
once you point it at your own collector (add data-compat="datafast" to keep DataFast's cookie
names; see switching from DataFast). This folder has a guide for
each platform and each way of serving the collector.
Your website's tracking id is in the dashboard under Settings > Tracking. Paste this in the
<head> of every page:
<script
defer
data-website-id="dgid_XXXXXXXXXXXXXXXX"
data-domain="example.com"
src="https://a.example.com/js/script.js"
></script>data-website-id: the tracking id. If you are moving from DataFast you can keep your existing id (DataGoat accepts any id you imported).data-domain: your root domain, so the visitor cookie coverswww.and every subdomain.src: where your DataGoat collector serves the tracker. Pick the address in step 2.- Other builds:
script.cookieless.js(no cookies) andscript.hash.js(hash-based routers). - Other attributes (
data-api-url,data-allowed-hostnames,data-allow-localhost,data-debug,data-disable-payments, ...) behave as DataFast documents them.
To call goals or identify before the script has loaded, add the queue first:
<script>
window.datagoat = window.datagoat || function () {
(window.datagoat.q = window.datagoat.q || []).push(arguments);
};
</script>The collector is your DataGoat Worker: it serves /js/script.js (a static asset that costs no Worker
request) and receives /api/events. Choose, in this order of preference:
| Setup | Code needed | Visitor IP and location | First-party cookies | Guide |
|---|---|---|---|---|
Worker route on your own zone (example.com/js/script.js) |
none | exact (Cloudflare sees the visitor) | yes | cloudflare-route.md |
Custom subdomain (a.example.com) |
none | exact | yes | custom-domain.md |
Proxy through your own server or host (/js/script.js on your app) |
a few lines | IP forwarded by you; see the caveat | yes | proxy.md |
*.workers.dev |
none | exact | script-set only | this page |
Setups 1 and 2 are DataGoat's equivalent of DataFast's "managed proxy": your visitors talk to Cloudflare directly under your own domain, so there is nothing to maintain and nothing that can drop the visitor's IP. Use a proxy only when your site is not on Cloudflare DNS.
Website builders and CMS: WordPress · WooCommerce · Shopify · Webflow · Framer · Squarespace · Wix · Ghost · Bubble · Kajabi · Podia · Easytool · Google Tag Manager
AI app builders: Lovable · Bolt · Replit · v0 by Vercel
Frameworks: Next.js · React Router / Remix · Vue · Astro · Django · Laravel · npm package
Apps: React Native / Expo · Web-to-app funnels · DataGoat mobile app
Proxies: overview · Cloudflare route · custom subdomain · Next.js · Vercel · Netlify · Nginx · Caddy · Express · Laravel · Django · Flask · FastAPI · PHP · Firebase Hosting · DigitalOcean · Astro · Vue / Vite
- Open your live site (not
localhost, unless you addeddata-allow-localhost="true"). - In the browser's Network tab,
script.jsloads from your collector and a request to/api/eventsanswers200. - The visit appears in the dashboard's Realtime view within a few seconds.
Nothing showing up? Ad blockers block some setups (use setup 1 or 2), a Content Security Policy may
block the script (allow your collector host in script-src and connect-src), and visits from your
own browser are ignored if localStorage.datagoat_ignore (or DataFast's
datafast_ignore) is "true".