> ## Documentation Index
> Fetch the complete documentation index at: https://docs.loops.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Web Analytics

> Track visitor behavior and identify users with the Loops analytics script

Using data from the Loops analytics script, we can tell you what pages on your site are the most effective at converting visitors into customers.

## Step 1: Get Your Tracking Script

Visit the dashboard to get the specific tracking script for your organization.

<Frame>
  <img src="https://mintcdn.com/loops-0dc3ece5/wGuuCRdpqAH-3EjR/assets/insights-onboarding/get-analytics-script.png?fit=max&auto=format&n=wGuuCRdpqAH-3EjR&q=85&s=07d07600c246a97f88c3bb804f478ad4" alt="Get Tracking Script" width="1216" height="1174" data-path="assets/insights-onboarding/get-analytics-script.png" />
</Frame>

## Step 2: Install the Tracking Script

Add the script to your website's `<head>` section:

```html theme={null}
<!-- Start Loops Analytics -->
<script
  defer
  src="https://stats.loops.fi/script.js"
  data-website-id="your-website-id">
</script>
<!-- End Loops Analytics -->
```

That's it! The script will automatically track page views and be available as `window.loops`.

## What Gets Tracked Automatically

Once installed, the script tracks:

* **Page views** - Every page visit
* **UTM parameters** - Campaign source, medium, and content
* **Referrers** - Where visitors came from
* **Device info** - Browser, OS, screen size
* **Facebook cookies** - `_fbc` and `_fbp` for Meta ad attribution
* **Google cookies** - `_gcl_aw`, `_gcl_au`, and `_ga` for Google Ads attribution

You can view this data on the analytics page in the dashboard.

<Frame>
  <img src="https://mintcdn.com/loops-0dc3ece5/wGuuCRdpqAH-3EjR/assets/insights-onboarding/web_analytics.png?fit=max&auto=format&n=wGuuCRdpqAH-3EjR&q=85&s=a7ed8ea0e0b58cffb71313fd8ff56c76" alt="Analytics Page" width="2434" height="1770" data-path="assets/insights-onboarding/web_analytics.png" />
</Frame>

## Step 3: Identify Users (SDK)

Besides tracking page views, the Loops script can also be used to identify users and track custom events.

When a user signs up or logs in, call `identify` to link their activity to their account:

```javascript theme={null}
loops.identify('user_123', {
  email: 'john@example.com',
  name: 'John Doe'
});
```

This connects their browsing history to their user profile, enabling accurate attribution.

## Step 4: Track Custom Events (Optional)

Track specific actions on your site:

```javascript theme={null}
loops.track('purchase', {
  product: 'Premium Plan',
  amount: 99.99
});
```
