Get started

Quickstart

Register your website, add one script, and check your first pageview. That’s the whole setup.

1. Register your site

Register your hostname before sending traffic. The collector normally drops traffic for unregistered hostnames without returning an error.

  1. Sign in at /login. For a new account, choose Google.
  2. Navigate to /app and click Add site.
  3. Enter your production hostname, such as example.com.

Do not include URL schemes (https://), paths, or port numbers. Each account can register up to 50 sites. All sites are private by default.

You can also register sites programmatically using POST /api/sites. See the Sites API Reference for request schemas.

2. Add the tracking script

Add this single script tag to your site HTML. Place it in your shared layout, document head, or before the closing body tag:

html
<script
  async
  src="https://analytics.bitgate.dev/latest.js"
  data-hostname="example.com"
></script>

To capture visits from users with JavaScript disabled, add an optional noscript pixel inside the HTML <body>:

html
<noscript>
  <img
    src="https://analytics.bitgate.dev/noscript.gif?hostname=example.com"
    alt=""
    referrerpolicy="no-referrer-when-downgrade"
  />
</noscript>

Always specify data-hostname to avoid domain detection mismatches. Subdomains and www prefixes are separate hostnames and are not combined automatically. Set data-hostname to the exact value you registered.

3. Verify incoming traffic

Open your site in a standard desktop or mobile web browser to verify the installation:

  1. Open your browser Developer Tools and select the Network tab.
  2. Filter requests by bitgate.dev.
  3. Verify that latest.js loads with HTTP 200.
  4. Find the request to simple.gif. Check that its query includes hostname=example.com and type=pageview, and that the response is HTTP 200 with content type image/gif.
  5. Navigate away or close the tab. The tracker may send an /append engagement beacon; it is not a second pageview.

A collector HTTP 200 is not proof that a row was saved: writes are asynchronous, and requests can be ignored. Check the exact page in /app, or query your site’s pages breakdown. Newly registered sites can take about a minute to reach collector instances that cached an earlier lookup.

When testing, keep these checks in mind:

  • Use a real browser. Headless browsers with navigator.webdriver enabled are marked as automated traffic; bot-marked rows do not count toward normal visitor and pageview totals.
  • Check browser extensions. Ad blockers and privacy tools can block analytics endpoints.
  • Check Do Not Track. The script honors navigator.doNotTrack === "1" by default and will not record visits.

4. Explore the API

You can query public stats directly without an account using our public demo domain:

bash
curl --fail-with-body -sS --max-time 30 \
  'https://analytics.bitgate.dev/api/sites/demo.bitgate.dev/overview?tz=UTC'

This endpoint returns JSON containing totals, previous, series, live, and granularity fields. Note that demo traffic is synthetically generated.

Public-site metadata and statistics allow unauthenticated reads. Private reports require the site owner’s token in the Authorization header. Import jobs remain owner-only even for public sites. Read the Stats API Reference for detailed parameter options and the Authentication Guide for bearer token usage.