LearnWeb Setup

Web Setup

Install the Hardal script on your website to auto-track page views and send e-commerce, lead generation, and custom conversion events

This documentation applies to the legacy Hardal platform. Open the legacy dashboard.

Installation

Add the Hardal script to your website using direct implementation or a Tag Manager.

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 Signal ID from Settings → Setup in the Hardal dashboard.

With data-auto-track="true", the script automatically collects page_view events including URL, title, and referrer. You do not need to fire page_view manually.


Navigate to the related section for recommended events.


Event Schema

Use these templates to send any event to Hardal. Replace the event name and data fields with your own values.

Web SDK
hardal.track("your_event_name", {
  your_field: "your_value",
  another_field: 123
});

Use consent parameter if you are planning to use Destinations for sending data to consent requiring endpoints; such as Ads channels.

Web SDK
hardal.track("your_event_name", {
  your_field: "your_value",
  another_field: 123,
  consent: true
});

Consent is required for Destinations in Marketing category. This requirement might change due to your region and regulations.


Sales

page_view

Collected automatically by the Hardal script — no manual call needed. Listed here for reference when sending via API.

Web SDK
// Automatically collected — no code needed.
// Only call manually if data-auto-track is disabled:
hardal.track("page_view");

view_item

Fires when a user views a product detail page.

Web SDK
hardal.track("view_item", {
  currency: "USD",
  value: 89.99,
  items: [{
    item_id: "RUN-AIR-42",
    item_name: "AirStride Running Shoes",
    item_brand: "TrailForce",
    item_category: "Footwear",
    item_category2: "Running",
    price: 89.99,
    quantity: 1
  }]
});

view_item_list

Fires when a user views a list of products (category page, search results).

Web SDK
hardal.track("view_item_list", {
  item_list_id: "bestsellers",
  item_list_name: "Bestsellers",
  items: [{
    item_id: "BOOK-1984",
    item_name: "Atomic Habits",
    item_brand: "Penguin",
    item_category: "Books",
    item_category2: "Self-Help",
    price: 14.99,
    quantity: 1,
    index: 0
  }]
});

select_item

Fires when a user clicks a product from a list.

Web SDK
hardal.track("select_item", {
  item_list_id: "search_results",
  item_list_name: "Search Results",
  items: [{
    item_id: "LAP-PRO-16",
    item_name: "ProBook 16 Laptop",
    item_brand: "NovaTech",
    item_category: "Electronics",
    item_category2: "Laptops",
    price: 1249.00,
    quantity: 1,
    index: 2
  }]
});

view_promotion

Fires when a user views a promotion (banner, offer).

Web SDK
hardal.track("view_promotion", {
  promotion_id: "PROMO_BF2025",
  promotion_name: "Black Friday 2025",
  creative_name: "blackfriday_hero",
  creative_slot: "homepage_banner"
});

select_promotion

Fires when a user clicks a promotion.

Web SDK
hardal.track("select_promotion", {
  promotion_id: "PROMO_BF2025",
  promotion_name: "Black Friday 2025",
  creative_name: "blackfriday_hero",
  creative_slot: "homepage_banner"
});

Fires when a user performs a site search.

Web SDK
hardal.track("search", {
  search_term: "bluetooth speaker"
});

add_to_cart

Fires when a user adds an item to their cart.

Web SDK
hardal.track("add_to_cart", {
  currency: "USD",
  value: 59.99,
  items: [{
    item_id: "EAR-WIRE-BLK",
    item_name: "SoundPods Wireless Earbuds",
    item_brand: "AudioWave",
    item_category: "Electronics",
    item_category2: "Audio",
    price: 59.99,
    quantity: 1
  }]
});

remove_from_cart

Fires when a user removes an item from their cart.

Web SDK
hardal.track("remove_from_cart", {
  currency: "USD",
  value: 12.99,
  items: [{
    item_id: "CASE-SLM-CLR",
    item_name: "SlimGuard Clear Phone Case",
    item_brand: "ShieldTech",
    item_category: "Accessories",
    item_category2: "Phone Cases",
    price: 12.99,
    quantity: 1
  }]
});

add_to_wishlist

Fires when a user adds an item to their wishlist.

Web SDK
hardal.track("add_to_wishlist", {
  currency: "USD",
  value: 299.00,
  items: [{
    item_id: "WATCH-FIT-44",
    item_name: "PulseFit Smartwatch 44mm",
    item_brand: "VivaGear",
    item_category: "Wearables",
    item_category2: "Smartwatches",
    item_variant: "midnight_black",
    price: 299.00,
    quantity: 1
  }]
});

view_cart

Fires when a user views their cart.

Web SDK
hardal.track("view_cart", {
  currency: "USD",
  value: 174.98,
  items: [
    {
      item_id: "HP-STUDIO-7",
      item_name: "Studio 7 Headphones",
      item_brand: "AudioWave",
      item_category: "Electronics",
      item_category2: "Audio",
      price: 129.99,
      quantity: 1
    },
    {
      item_id: "KB-MECH-TKL",
      item_name: "ClickForce TKL Keyboard",
      item_brand: "TypeCraft",
      item_category: "Electronics",
      item_category2: "Peripherals",
      price: 44.99,
      quantity: 1
    }
  ]
});

begin_checkout

Fires when a user begins checkout.

Web SDK
hardal.track("begin_checkout", {
  currency: "EUR",
  value: 549.00,
  coupon: "WELCOME10",
  items: [{
    item_id: "CAM-MIRR-X5",
    item_name: "LensPro X5 Mirrorless Camera",
    item_brand: "OpticVision",
    item_category: "Electronics",
    item_category2: "Cameras",
    price: 549.00,
    quantity: 1
  }]
});

add_shipping_info

Fires when a user submits shipping information during checkout.

Web SDK
hardal.track("add_shipping_info", {
  currency: "GBP",
  value: 189.00,
  coupon: "FREESHIP",
  shipping_tier: "Next-day",
  items: [{
    item_id: "COF-BREW-DLX",
    item_name: "BrewMaster Deluxe Coffee Machine",
    item_brand: "BeanTech",
    item_category: "Home & Kitchen",
    item_category2: "Coffee Machines",
    price: 189.00,
    quantity: 1
  }]
});

add_payment_info

Fires when a user submits payment information during checkout.

Web SDK
hardal.track("add_payment_info", {
  currency: "USD",
  value: 349.99,
  coupon: "GAMER15",
  payment_type: "Credit Card",
  items: [{
    item_id: "MON-GAME-27",
    item_name: "PixelEdge 27" Gaming Monitor",
    item_brand: "ViewMax",
    item_category: "Electronics",
    item_category2: "Monitors",
    price: 349.99,
    quantity: 1
  }]
});

purchase

Fires when a user completes a purchase.

Web SDK
hardal.track("purchase", {
  transaction_id: "ORD-20250615-7891",
  value: 214.98,
  currency: "USD",
  tax: 17.20,
  shipping: 5.99,
  coupon: "SUMMER20",
  items: [
    {
      item_id: "JKT-WIND-M",
      item_name: "StormShield Windbreaker",
      item_brand: "PeakWear",
      item_category: "Apparel",
      item_category2: "Jackets",
      item_variant: "navy_blue",
      price: 79.99,
      quantity: 1,
      discount: 16.00
    },
    {
      item_id: "SNK-URBAN-10",
      item_name: "UrbanGlide Sneakers",
      item_brand: "StepUp",
      item_category: "Footwear",
      item_category2: "Sneakers",
      item_variant: "white_grey",
      price: 134.99,
      quantity: 1
    }
  ]
});

refund

Fires when a user receives a refund. Include items for item-level refund reporting.

Web SDK
hardal.track("refund", {
  transaction_id: "ORD-20250615-7891",
  value: 134.99,
  currency: "USD",
  tax: 10.80,
  items: [{
    item_id: "SNK-URBAN-10",
    item_name: "UrbanGlide Sneakers",
    item_brand: "StepUp",
    item_category: "Footwear",
    item_category2: "Sneakers",
    price: 134.99,
    quantity: 1
  }]
});

Leads

generate_lead

Fires when a user submits a lead form or inquiry.

Web SDK
hardal.track("generate_lead", {
  lead_id: "LEAD-12345",
  currency: "USD",
  value: 500,
  lead_source: "Trade show",
  name: "John Doe",
  category: "Enterprise",
  type: "demo_request",
  label: "Summer Campaign",
  country: "US",
  city: "San Francisco",
  district: "California"
});

sign_up

Fires when a user creates an account.

Web SDK
hardal.track("sign_up", {
  method: "Google"
});

login

Fires when a user logs in.

Web SDK
hardal.track("login", {
  method: "Email"
});

share

Fires when a user shares content.

Web SDK
hardal.track("share", {
  method: "WhatsApp",
  content_type: "product",
  item_id: "RUN-AIR-42"
});

subscribe

Fires when a user subscribes to a list or notifications.

Web SDK
hardal.track("subscribe", {
  list_name: "Weekly Deals",
  list_id: "NL_DEALS_01"
});

trial_start

Fires when a user starts a free trial.

Web SDK
hardal.track("trial_start", {
  plan: "business",
  trial_days: 30,
  value: 79.00,
  currency: "USD"
});

Games

earn_virtual_currency

Fires when a user earns virtual currency (coins, gems, tokens).

Web SDK
hardal.track("earn_virtual_currency", {
  virtual_currency_name: "StarCoins",
  value: 150
});

spend_virtual_currency

Fires when a user spends virtual currency.

Web SDK
hardal.track("spend_virtual_currency", {
  virtual_currency_name: "StarCoins",
  value: 75,
  item_name: "Dragon Shield"
});

tutorial_begin

Fires when a user begins a tutorial. No additional parameters.

Web SDK
hardal.track("tutorial_begin");

tutorial_complete

Fires when a user completes a tutorial. No additional parameters.

Web SDK
hardal.track("tutorial_complete");

Identify

distinct

Fires when a user logs in, signs up, or gives consent for processing personal information. Links all subsequent events to a known user profile.

Web SDK
hardal.distinct({
  email: "alex@example.com",
  firstName: "Alex",
  lastName: "Rivera",
  customerId: "USR_8827",
  phone: 14155551234,
  birthday: "1990-01-15",
  gender: "male",
  city: "San Francisco",
  state: "CA",
  zip: "94107",
  country: "US"
});

Item Object

Used by view_item, view_item_list, select_item, add_to_cart, remove_from_cart, add_to_wishlist, view_cart, begin_checkout, add_shipping_info, add_payment_info, purchase, and refund.

view_item, add_to_cart, and purchase must send the same item details for accurate funnel reporting.

item_idstring

Unique product identifier. Example: RUN-AIR-42

item_namestring

Product name. Example: AirStride Running Shoes

item_brandstring

Brand name. Example: TrailForce

item_categorystring

Primary category. Example: Footwear

pricenumber

Unit price. Use discounted price if applicable. Example: 89.99

quantityinteger

Quantity. Defaults to 1. Example: 2