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 URL | Domain 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
| Attribute | Behavior | Recommendation |
|---|---|---|
defer | Loads in parallel, executes after HTML parsing | Recommended |
async | Loads in parallel, executes as soon as ready | Good alternative |
| No attribute | Blocks HTML parsing until loaded | Not 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
| Parameter | Description | Default |
|---|---|---|
d | Your domain (required) | — |
api | Custom 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
- Open your website
- Open browser DevTools (F12 or Cmd+Option+I)
- Go to the Network tab
- Filter by
t.js - Refresh the page
- You should see a
200status for the script
Check tracking requests
- In the Network tab, filter by
loamly - Navigate around your site
- You should see POST requests to
app.loamly.ai/tfor each page view
Check dashboard
- Open your Loamly dashboard
- Go to the Real-time section
- 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: