Skip to content

Tracking your first site

Learn how to start tracking your first site.

Let’s get started by adding LWS Analytics to your website.

First, you’ll need an account. You can create a new account here or login if you already have one.

Creating a site requires the following information:

  • Site name: The name of your site, can be anything you want really.
  • Domain: The domain of the site you want to track (additional domains can be added later).
  • Reporting timezone: This is the timezone that determines what ‘today’ means. We handle UTC on our server, but you would want to see reports in your local timezone.

The recommended way to add LWS Analytics is via our npm package. No external script tag required - just install the package and start tracking.

Terminal window
npm install @lws-analytics/script

Then initialize it once in your app’s entry point:

// app/layout.tsx or index.tsx
import { init } from '@lws-analytics/script';
// Initialize once at app startup
init({ siteId: 'your-site-id' });
export default function App({ children }) {
return <>{children}</>;
}

Replace your-site-id with the site ID from your dashboard.

That’s it ✨ it can really be this simple.

To test if everything is working, visit the site you are tracking and refresh the dashboard. You should see that at least one unique visitor has visited your site.

Continue to the next article to learn how to track custom events.