Documentation

Installation

Add Loamly tracking to any website

Universal installation

Loamly works on any website. Add the following script to your HTML <head> section:

<script
  src="https://app.loamly.ai/t.js?d=yourdomain.com"
  defer
></script>

Replace yourdomain.com with your website domain. This should match exactly what visitors see in their browser address bar.

Examples

Website URLDomain parameter
https://example.com?d=example.com
https://www.example.com?d=www.example.com
https://app.example.com?d=app.example.com
https://example.webflow.io?d=example.webflow.io

Domain matching

The domain must exactly match your site. If your site uses www.example.com, the parameter should be ?d=www.example.com, not ?d=example.com.

Script options

Loading strategies

AttributeBehaviorRecommendation
deferLoads in parallel, executes after HTML parsingRecommended
asyncLoads in parallel, executes as soon as readyGood alternative
No attributeBlocks HTML parsing until loadedNot recommended
<!-- Recommended: defer -->
<script src="https://app.loamly.ai/t.js?d=example.com" defer></script>

<!-- Alternative: async -->
<script src="https://app.loamly.ai/t.js?d=example.com" async></script>

Additional parameters

ParameterDescriptionDefault
dYour domain (required)
apiCustom API endpoint (for proxying)app.loamly.ai

Single-page apps

Loamly automatically detects route changes in single-page applications. This works out of the box with:

  • React / React Router
  • Next.js (App Router and Pages Router)
  • Vue / Vue Router / Nuxt
  • Angular
  • SvelteKit
  • Any framework using the History API

No additional configuration is needed. Loamly listens for popstate and pushState / replaceState events.

Manual page tracking

If you need to manually trigger a page view (rare), use the page() method:

// Manually track a page view
window.loamly?.page();

// With custom path (optional)
window.loamly?.page({ path: '/custom-path' });

Verification

Check script loading

  1. Open your website
  2. Open browser DevTools (F12 or Cmd+Option+I)
  3. Go to the Network tab
  4. Filter by t.js
  5. Refresh the page
  6. You should see a 200 status for the script

Check tracking requests

  1. In the Network tab, filter by loamly
  2. Navigate around your site
  3. You should see POST requests to app.loamly.ai/t for each page view

Check dashboard

  1. Open your Loamly dashboard
  2. Go to the Real-time section
  3. Your visits should appear within seconds

Self-visits filtered

By default, Loamly may filter your own visits if you are logged in to the dashboard in the same browser. Use an incognito window to test accurately.

Platform guides

For step-by-step instructions on specific platforms: