# Cabin Analytics Documentation > Cabin is privacy-first, cookie-free web analytics. No cookies, no consent banner, a 2 KB script, carbon reporting and MCP access for AI agents. # Cabin Analytics Documentation Cabin is a privacy-first, carbon-conscious web analytics service. It's lightweight, compliant with all [privacy laws](https://docs.withcabin.com/privacy.md), and the ideal cookieless alternative to Google Analytics. - No cookies, so no consent banner - No data sharing and no ad networks - A 2 KB script that won't slow your site down - Compliant with GDPR, CCPA, and more Cabin comes in three plans, Free, Plus and Scale, and every one of them includes the full dashboard, [scroll depth](https://docs.withcabin.com/scroll-depth.md), [AI/MCP access](https://docs.withcabin.com/mcp.md), [public dashboards](https://docs.withcabin.com/sharing.md#public-dashboards) and [data export](https://docs.withcabin.com/export-options.md). See [plans and limits](https://docs.withcabin.com/plans.md) for what the paid plans add. This documentation is available in [English](https://docs.withcabin.com/index.md), [Français](https://docs.withcabin.com/fr.md), [Deutsch](https://docs.withcabin.com/de.md), [Nederlands](https://docs.withcabin.com/nl.md), [Italiano](https://docs.withcabin.com/it.md) and [日本語](https://docs.withcabin.com/ja.md). ## Privacy by Design Cabin is built from the ground up using **Privacy by Design** principles. We never store unique identifiers for your visitors, and our non-relational data structure makes it impossible to identify individuals based on their location, browser, OS, or language. We don't sell or share any data with third parties or ad networks. Your visitors' data remains private and useless to advertising platforms. ## Environmental Responsibility Cabin's tracking script is 2 KB compressed, a fraction of the size of Google Analytics' loader, and that loader then pulls in far more JavaScript behind it. Keeping Cabin that small is a constraint we defend, not a happy accident: you can check the number yourself in your browser's network tab. Beyond the script, the biggest lever on a hosted service's emissions is where its servers sit, because that decides which electricity grid they draw from. Cabin's ingest servers, the ones your visitors' browsers talk to, are placed with that in mind: - **Clean grids first.** Two of the three regions Cabin runs in draw from grids that are over 95% carbon-free. The third serves Asia-Pacific, where no clean grid exists, and is the least carbon-intensive option that still keeps latency low there. - **Close to visitors.** Each region takes the traffic nearest to it, so a beacon travels a short distance and the page view is recorded quickly, which matters on a fast bounce. - **Small, efficient machines.** Ingest is light work, so each region runs on a small server rather than a large one sitting mostly idle. That's cheaper and lower in energy. The same grid-intensity methodology sits behind [your site's carbon estimates](https://docs.withcabin.com/energy-and-carbon.md), which use The Green Web Foundation's CO2.js. ## Data Collection The Cabin script sends minimal data points, with additional information inferred from the user-agent and request headers. #### Sent by the script | Data point | When | | --- | --- | | Page URL | Every page view | | Referrer | First page view of a visit only | | Screen width | Every page view | | Page load time | Every page view | | Visit counts | Every page view | | Time on page | When the visitor leaves the page | | [Scroll depth](https://docs.withcabin.com/scroll-depth.md) | When the visitor leaves the page | | [Event name](https://docs.withcabin.com/events.md) | Only when your site triggers an event | The referrer's query string is stripped before it leaves the browser, so nothing sensitive in a referring URL reaches us. #### Inferred from the request | Data point | Example | | ------------ | ------------- | | Timestamp | 1627589208201 | | Source | social | | Country | GB | | Browser | chrome | | Device | mobile | | OS | iOS | | Language | en | | Bounce | false | | utm_source | instagram | | utm_campaign | summer_sale | | utm_medium | paid_social | ## Unique Visitors Without Cookies > How does Cabin determine unique visitors without storing identifiers? Cabin counts unique visitors without identifiers, IP addresses or fingerprinting, using a property of HTTP caching that browsers already have: When a visitor interacts with Cabin, the request is cached in their browser like any standard web resource. We set a `last-modified` header in the response to the start of the current day. On subsequent requests, the browser automatically sends this header back to check if the request is still valid. Cabin then increments the `last-modified` time by one second with each visit. By calculating the difference between the `last-modified` time and the day's start, we can determine the number of visits without storing any personal data. The first request indicates a unique visit, while subsequent requests help us track metrics like [bounce rate](https://docs.withcabin.com/bounce-rate.md). You can read more about this on our blog: [How Cabin measures unique visitors without cookies](https://withcabin.com/blog/how-cabin-measures-unique-visitors-without-cookies). ## Visitor Geolocation Every web request includes an IP address. Cabin converts this address **in transit** (within server memory only) to an [ISO country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) with no further location detail. We store only the country code. The IP address is immediately discarded and never logged. For where that happens and where your data is stored, see the [privacy policy](https://withcabin.com/privacy). --- # Installing Cabin Start by adding your domain on the [Domains](https://withcabin.com/settings/domains) page. Then follow the instructions below to add Cabin to your site. The script is the same everywhere: one line, 2 KB, no configuration. Once it's live, visits show up in your dashboard within a few seconds. It's also open source. You can read exactly what runs on your visitors' browsers at [github.com/withcabin/hello.js](https://github.com/withcabin/hello.js), and the built file in that repository is byte-for-byte the one the CDN serves, so there's nothing to take on trust. ## Basic Installation Place the following code before your closing `
{children}` tag. ```html ``` ## WordPress 1. Install the [Insert Headers and Footers](https://wordpress.org/plugins/insert-headers-and-footers/#installation) plugin. 2. Go to **Settings** > **Insert Headers and Footers** menu. 3. Paste the code below into the **Footer scripts**: ```html ``` 4. Click **Save**. ## Shopify > [!NOTE] > This requires access to your Shopify theme code. 1. From your Shopify admin, go to **Online Store** > **Themes**. 2. Find the theme you want to edit and click **Actions** > **Edit code**. 3. In the Layout directory, click on `theme.liquid`. 4. Find the closing `` tag and paste the following code just before it: ```html ``` 5. Click **Save**. ## WooCommerce 1. Install and activate the [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin. 2. Go to **Snippets** > **Add New**. 3. Give your snippet a title like "Cabin Analytics". 4. Paste the following code: ```php function add_cabin_analytics() { echo ''; } add_action('wp_footer', 'add_cabin_analytics'); ``` 5. Set the snippet to run on the "Frontend" only. 6. Click **Save Changes and Activate**. Alternatively, you can follow the WordPress instructions above using the Insert Headers and Footers plugin. ## Squarespace > [!NOTE] > Only available on Squarespace's Business or Commerce plans. 1. Click **Settings**, click **Advanced** and then click **Code Injection** 2. Add the following code to the **Footer**: ```html ``` 3. Click **Save** at the top of the page. More details at [Squarespace](https://support.squarespace.com/hc/en-us/articles/205815908-Using-Code-Injection) ## Wix > [!NOTE] > Only available on a paid Wix plan. 1. Click **Settings** in your site's dashboard. 2. Click the **Tracking & Analytics** tab under **Advanced Settings**. 3. Click **+ New Tool** and select **Custom** from the dropdown. 4. Paste in the code from below: ```html ``` 5. Select the relevant domain. _Note: This option will appear only if you have multiple domains_. 6. Enter a name for your custom code. E.g. _Cabin Script_ 7. Add Code to Pages: Choose **All Pages** and **Load code once**. 8. Place Code in: Choose **Body - end**. 9. Click **Apply**. More details on [Wix](https://support.wix.com/en/article/embedding-custom-code-to-your-site) ## Next.js Create or edit the `app/layout.js` (or `app/layout.tsx`) file and import the script in your RootLayout component: ```jsx import Script from 'next/script' export default function RootLayout({ children }) { return (