Skip to content
CloseYourItdocsPages

Documentation / Using CloseYourIt

Site analytics

How many people visit the site, what they look at and where they come from, without cookies.

Site analytics tells you how many visits and visitors the site has, which pages are viewed most and where the traffic comes from. It uses no cookies and stores no personal data.

Turn on analytics

You need a project with the Web platform and two things together: the switch and the code in the pages.

  1. In the project Settings turn on Collect site analytics.
  2. Paste this code in the site pages, inside the head:
<script src="https://cdn.jsdelivr.net/npm/@bussolabs/closeyourit-js@0/dist/closeyourit.min.js"></script>
<script>
  CloseYourIt.init({
    endpointUrl: "https://bugs.example.com",
    publicKey: "<project public key>",
    projectId: "<project id>",
    environment: "production",
    trackPageviews: true,
  })
</script>
  1. Open Site analytics: the first visit shows up within a few seconds.

The in-app guide gives you the same code already filled in for the project you pick. If you already use the SDK, just add trackPageviews: true (see JavaScript).

What is counted

  • One visit on every page load and on every page change in single-page apps. A change that stays on the same page does not count.
  • Of the page, only the domain and the path are sent, never the parameters after ?. The referring page and the UTM campaign parameters are sent too.
  • The visitor is an anonymous code computed by the server, which changes every day. The network address and the browser are used to compute it and are not stored.

To count a page by hand, for example a step of a wizard:

CloseYourIt.capturePageview({ path: "/wizard/step-2" })

What you see

  • The numbers for the period: pageviews, visitors, bounce, average visit length, pages per visit. Changes are compared with the previous period of the same length.
  • Now: the visitors of the last 30 minutes.
  • Top pages and Entry & exit pages.
  • Where they come from: Top referrers, Channels (direct, search, social, AI assistants, other sites, email, paid campaigns) and Campaigns (UTM).
  • Locations: the country.
  • Browser & operating system, Device & screen.

You can pick project, environment and period: last 24 hours, 7 days, 30 days or one year.

Custom events

An event marks an action that matters, for example a sign-up:

CloseYourIt.captureEvent("Signup")

Events do not count as visits: they feed the goals.

Goals

A goal is a visit or an event that counts as a target reached.

  1. Press Manage goals, then New goal.
  2. Give it a Name and pick the Type:
    • Pageview path: an exact path, or a prefix with * (for example /blog/*);
    • Custom event: the name passed to captureEvent.
  3. Press Save goal.

For each goal you see unique visitors, the total and the conversion rate. Deleting a goal removes only its count: visits and events stay.

Share the analytics

Create link publishes a read-only page with the project's analytics. You get the public address and a code to embed it in another site. The page shows only aggregated numbers, never single visitors.

To protect the link with a password, create it from the command line:

cyi analytics share --project <id or key> --password <password>

Revoke turns the link off. Creating and revoking the link needs a dedicated permission (see Permissions).

Read the data from a program

With a project token that has the read permission:

curl https://bugs.example.com/api/v1/projects/$PROJECT_ID/analytics?range=30d \
  -H "Authorization: Bearer $CYI_TOKEN"

range is 24h, 7d, 30d or 1y; environment picks the environment. The answer holds the summary, the trend over time, the breakdowns, the channels and the goals. From the command line: cyi analytics show --project <id or key>.

How long the data stays

One year by default. Change it in Site analytics retention (days), in the organization or project settings.