Skip to main content
Add Hardal tracking script to your website using direct implementation or Google Tag Manager.

Direct Implementation

1

Get Script Configuration

  1. Log into Hardal dashboard
  2. Navigate to Settings → Setup
  3. Copy your Signal ID
2

Add Script

Add to your HTML <head> section:
<script
  defer
  src="https://<your-signal-id>-signal.usehardal.com/hardal"
  data-website-id="<your-signal-id>"
  data-host-url="https://<your-signal-id>-signal.usehardal.com"
  data-auto-track="true"
></script>
Replace <your-signal-id> with your actual Signal ID from Hardal Dashboard.

Google Tag Manager

1

Create HTML Tag

  1. Access GTM workspace
  2. Create Custom HTML tag
  3. Add script:
<script
  defer
  src="https://<your-signal-id>-signal.usehardal.com/hardal"
  data-website-id="<your-signal-id>"
  data-host-url="https://<your-signal-id>-signal.usehardal.com"
  data-auto-track="true"
></script>
2

Configure and Publish

  1. Replace <your-signal-id> with your actual Signal ID from Hardal Dashboard.
  2. Set trigger for desired pages
  3. Publish GTM container

Custom Events

Track custom events using:
hardal.track(eventName, eventProperties);
Example:
hardal.track("purchase", {
  transaction_id: "ORDER123",
  value: 99.99,
  currency: "USD"
});

User Identification with Distinct Event

Use hardal.distinct() to update user session properties and identify users after login, signup, or marketing consent:
hardal.distinct({
  email: "[email protected]",
  name: "John Doe", 
  plan: "premium",
  user_id: "12345"
});
Alternative syntax:
hardal.distinct(property, value);
When to use:
  • After user login or signup
  • When user provides marketing consent
  • When user profile information is updated
  • To link anonymous sessions to identified users
The distinct event updates the user’s session properties, allowing you to identify and track users across their journey.