Overview

The Hardal Web Script enables you to track user behavior and collect analytics data from your web applications. This guide will walk you through the basic installation and configuration process.

Prerequisites

Before you begin the installation, ensure you have:

  • Access to your website’s HTML source code

  • Admin access to your Hardal dashboard

  • Basic knowledge of HTML and JavaScript

You should create a custom domain for first-party data ownership. It is best practice to create one before the installation.

Installation

1

Get your Hardal Script

  1. Log into your Hardal account

  2. Navigate to settings

  3. Copy your Hardal Script from “Setup” tab

2

Add the Script

Add your Hardal Script to your HTML file, preferably in the <head> section. The script should look like following:

<script>
    !function(h,a,r,d,l) {
        window.hardalConfig = {
            endpoint: "https://<your-hardal-signal-id>-signal.usehardal.com",
            options: {
                autoPageview: true,
                fetchFromGA4: true,
                fetchFromDataLayer: true,
            }
        };
        a = document.createElement('script');
        r = document.getElementsByTagName('script')[0];
        a.async = 1;
        a.src = "https://<your-hardal-signal-id>-signal.usehardal.com/hardal";
        r.parentNode.insertBefore(a, r);
    }(window);
</script>

Replace <your-hardal-signal-id> with your actual Signal ID.

If you create a custom domain and check it within the same setup page, your Hardal Script will be updated with regarding endpoint.

3

Verify Installation

To verify your installation:

  1. Open your browser’s developer tools (F12 or right-click → Inspect)

  2. Go to the Network tab

  3. Refresh your page

  4. Look for requests to your Hardal endpoint

  5. Verify that events are being sent successfully

  6. Check your Hardal Dashboard to see real-time events are reflected accordingly

Configuration Options

The script supports the following configuration options in the window.hardalConfig.options object:

OptionTypeDefaultDescription
autoPageviewbooleantrueAutomatically tracks page views when enabled
fetchFromGA4booleantrueCollects events from Google Analytics 4
fetchFromDataLayerbooleantrueCollects events from dataLayer
debugbooleanfalseEnables detailed logging in console

Troubleshooting

Common Installation Issues