Integrations: HTML and JavaScript

To integrate MetricsWave in your HTML and JavaScript site you just need to add the visits script. This should be added inside the <head> tag in all your sites.

It's a super small script (less than 1KB) so it's going to load fast without compromising the user experience or loading time.

How to measure your traffic

Inside your index.html file you just need to add the script inside the head tag.

Something like this:

<!DOCTYPE html>
<html lang="en">

<head>
    <!-- Other tags in your file -->


    <!-- Add MetricsWave visit script -->
    <script defer
            event-uuid="00000000-0000-0000-0000-000000000000"
            src="https://tracker.metricswave.com/js/visits.js"></script>

</head>

<body>
    <!-- website content -->
</body>

</html>

How to measure events

To trigger events whenever you want you will need to use the API.

You have multiple options to do this, but a simple one it's to create a function like the next and use it everywhere in your application.

You only need to pass the trigger UUID and the parameters of your event.

export function triggerEvent(eventUuid, params = {}) {
    fetch(`https://metricswave.com/webhooks/${eventUuid}`, {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
            "Accept": "application/json",
        },
        body: JSON.stringify(params),
    })
}

← Go back to Documentation

Choose the plan
that fits your needs

Start for free, and upgrade your account at any moment.

All plans include:

  • 100% data ownership
  • Forever data retention
  • No cookie banner required
  • GDPR law compliance
  • Unlimited support
  • Cancel at any time
  • All features available