Skip to main content

Plain HTML

No build tool or framework required. Add Haya to any website with a single script tag.

Basic setup

Add this snippet before the closing </body> tag on every page you want to track:

<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>

<!-- Your page content -->

<script src="https://cdn.usehaya.io/haya.min.js"></script>
<script>
haya.init('YOUR_SDK_KEY', {
sessionReplay: true,
heatmaps: true,
autoTrack: {
clicks: true,
scrolls: true,
pageviews: true,
},
maskInputs: true,
});
</script>
</body>
</html>

Replace YOUR_SDK_KEY with the key from your Haya dashboard.

Multi-page sites

Add the same snippet to every page. The SDK is small (~45 KB gzipped) and caches well — users only download it once.

If you have a shared layout file (like a PHP or WordPress template), add the snippet there so it appears on every page automatically.

Tracking custom events

<button id="signup-btn">Sign up free</button>

<script>
document.getElementById('signup-btn').addEventListener('click', function () {
haya.track('signup_clicked', { source: 'hero' });
});
</script>

WordPress

In WordPress, add the snippet via Appearance → Theme Editor → footer.php just before </body>, or use a plugin like Insert Headers and Footers.

<!-- Paste in footer.php before </body> -->
<script src="https://cdn.usehaya.io/haya.min.js"></script>
<script>
haya.init('YOUR_SDK_KEY', {
sessionReplay: true,
heatmaps: true,
autoTrack: { clicks: true, scrolls: true, pageviews: true },
maskInputs: true,
});
</script>

Webflow

In Webflow, go to Site Settings → Custom Code → Footer Code and paste the snippet. This adds it to every page automatically.

Shopify

In Shopify, go to Online Store → Themes → Edit Code → theme.liquid and add the snippet before </body>.

Verify it's working

Open your browser DevTools (F12) → Console. If debug: true is set you'll see:

[Haya] Initialized for project YOUR_SDK_KEY
[Haya] Batch sent (3 events)

Or check the Network tab and filter by the Haya endpoint URL to see outgoing event batches.