D
Data Silo

Installation

Every snippet below uses YOUR_SITE_IDas a placeholder. Grab the real one from a site's Settings page.

Quick start

Data Silo tracks with a single script tag. No cookie banner, no config file, no build step. Paste it before the closing </head> and you're done.

html
<script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>

Plain HTML

Add the snippet to every page, right before </head>:

index.html
<!doctype html>
<html>
  <head>
    <title>My site</title>
    <script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>
  </head>
  <body>...</body>
</html>

Next.js

Use next/script in your root layout so it loads once across the App Router:

app/layout.tsx
import Script from "next/script";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          defer
          data-site-id="YOUR_SITE_ID"
          src="https://yourdomain.com/monitor.js"
        />
      </body>
    </html>
  );
}

React (Vite / Create React App)

React has no built-in way to manage <head>, so add the script directly to your index.html:

index.html
<head>
  ...
  <script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>
</head>

Vue.js

Same idea: add it to the index.html that Vite serves:

index.html
<head>
  ...
  <script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>
</head>

Nuxt

Add it once, globally, with the built-in useHead composable in app.vue:

app.vue
<script setup>
useHead({
  script: [
    {
      defer: true,
      "data-site-id": "YOUR_SITE_ID",
      src: "https://yourdomain.com/monitor.js",
    },
  ],
});
</script>

SvelteKit

Add it to src/app.html, which wraps every page:

src/app.html
<head>
  ...
  <script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>
</head>

Angular

Add it to src/index.html, which every route shares:

src/index.html
<head>
  ...
  <script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>
</head>

WordPress

Use a plugin like Insert Headers and Footers, or paste the snippet directly into your theme's header.php just before <?php wp_head(); ?> closes:

html
<script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>

Shopify

In your theme editor, open theme.liquid and add the snippet right before </head>:

theme.liquid
<script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>

Webflow

Go to Site settings → Custom code and paste the snippet into Head code, then publish your site:

html
<script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>

Squarespace

Go to Settings → Advanced → Code Injection and paste the snippet into the Header box (this requires a Business or Commerce plan):

html
<script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>

Google Tag Manager

Create a new Custom HTML tag with the snippet below, and set its trigger to All Pages:

html
<script defer data-site-id="YOUR_SITE_ID" src="https://yourdomain.com/monitor.js"></script>

Custom events & goals

Call window.datasilo('track', name, props) from anywhere on the page to record a custom event, then turn it into a goal from a site's Goals & Funnels page.

javascript
document.querySelector("#signup-form").addEventListener("submit", () => {
  window.datasilo("track", "Signup", { plan: "pro" });
});

Revenue attribution

To attribute a Stripe purchase back to a traffic source, fetch the current visitor id and pass it as client_reference_id when you create the Checkout Session:

javascript
window.datasilo("getVisitorId", (visitorId) => {
  fetch("/create-checkout-session", {
    method: "POST",
    body: JSON.stringify({ visitorId }),
  });
});

Then in your own backend, pass that value through to Stripe as client_reference_id, and configure the webhook URL shown on the site's Settings page. Full details are on that page once revenue attribution is enabled.

API, CLI & MCP

Create an API key from a site's Settings page, under API access. The key is shown once, so store it somewhere safe. Every method below (REST, CLI, MCP) uses the same key and the same underlying endpoints — pick whichever fits how you want to pull data out.

REST API

Pass the key as a bearer token. {siteId}is the site's id (visible in its dashboard URL, not the tracking id used in the snippet above).range is optional and defaults to 7d (also accepts 30d or 90d).

bash
curl "https://yourdomain.com/api/v1/sites/YOUR_SITE_ID/stats?range=7d" \
  -H "Authorization: Bearer YOUR_API_KEY"

Three endpoints are available, all under /api/v1/sites/{siteId}:

  • /stats— pageviews, visitors, bounce rate, avg. session duration, live visitor count
  • /top-pages— most-viewed pages for the range
  • /revenue— total revenue and revenue by traffic source (requires Stripe revenue attribution)

CLI

Install @data-silo/cli globally, or run it with npx without installing anything:

bash
npm install -g @data-silo/cli
# or: npx @data-silo/cli stats --site YOUR_SITE_ID

Commands stats, top-pages, and revenue map directly to the REST endpoints above:

bash
export DATASILO_API_KEY=YOUR_API_KEY
datasilo stats --site YOUR_SITE_ID --range 30d

Flags:

  • --site <id>— required, the site's id (same one used above)
  • --range <range>7d, 30d, or 90d (default 7d)
  • --api-key / --api-url— override the environment variables for a single call
  • --raw— compact JSON instead of pretty-printed, useful for piping into jq
  • -v, --version / -h, --help

MCP server

Exposes the same three endpoints as tools (get_stats, get_top_pages, get_revenue_by_source) so an MCP client like Claude Desktop can query your analytics directly. Add it to your client config:

json
{
  "mcpServers": {
    "datasilo": {
      "command": "npx",
      "args": ["-y", "@data-silo/mcp"],
      "env": {
        "DATASILO_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Both datasilo and datasilo-mcp also honor DATASILO_API_URLas an environment variable if you're self-hosting instead of using https://yourdomain.com.