Order tracking: developer docs

See in HalalAdz when someone who saw or clicked your ad buys, sends a form or signs up. With or without a website, pick one of the paths below. We never collect names, phone numbers or e-mails.

1. Website pixel

Open Conversions → Setup in the dashboard. The code there already has your own pixel id. Press Copy and put it in the <head> of every page, or press “Email this to my developer”. The script is small and loads without slowing the page.

Code for every page
<!-- HalalAdz Pixel: on every page, inside <head> -->
<script async src="https://cdn.halaladz.com/px.js" data-hz-pixel="hzp_123_AbCdEfGhIjKl" data-hz-api="https://api.halaladz.com"></script>
<script>window.hzq = window.hzq || [];</script>

A page view is sent on its own. Send add to cart, lead, sign up and order like this. The amount can be in any currency (ISO 4217 code: BDT, USD, EUR, MYR, SAR …). Put your order number in eventId: when the same id also comes from your server, the order counts once.

Sending events
<script>
  window.hzq = window.hzq || [];
  // page view is sent on load (data-hz-pageview="off" turns it off)
  hzq.push(["track", "add_to_cart"]);
  hzq.push(["track", "lead"]);
  hzq.push(["track", "signup"]);
  // thank-you page: amount + any ISO 4217 currency + your order id
  hzq.push(["track", "order", { value: 1499.50, currency: "EUR", eventId: "ORDER-1234" }]);
</script>

The pixel keeps one first-party id only (_hz_click), to know the visitor came from a HalalAdz ad. The admin sets per country whether consent is needed first. By default nothing is stored without consent in the EU / EEA, the UK and Switzerland; in the US and Canada storing stops when the visitor says no; when the country is unknown, consent comes first. Without consent, orders on the landing page that came from our link still count, with nothing stored.

Giving or taking back consent
<!-- after your own consent banner says yes -->
<script>hzq.push(["consent", true]);</script>
<!-- the visitor says no: stop and delete the stored id -->
<script>hzq.push(["consent", false]);</script>
<!-- or use our small built-in banner -->
<script async src="https://cdn.halaladz.com/px.js" data-hz-pixel="hzp_123_AbCdEfGhIjKl" data-hz-api="https://api.halaladz.com" data-hz-banner="on"></script>

WhatsApp and call buttons

On a page with the pixel, every tap on these buttons is counted.

A counted WhatsApp button
<a data-hz-button="whatsapp" data-hz-to="+8801700000000">WhatsApp</a>

2. WordPress, Shopify and Google Tag Manager

WordPress and WooCommerce

The plugin adds the pixel to every page. With WooCommerce, add to cart and orders (amount, currency, order number) are sent on their own. With a server key, orders are also sent from your server; the same order number means they count once.

Download the plugin (halaladz-tracking.zip)

Check the file is complete: SHA-256 · SHA256SUMS.txt
eeaac42cbaccfcb01ef2de44fbe0e427b78af8f7ace3185f8433949512dd8a56  halaladz-tracking.zip
Installing the WordPress plugin
1. Download halaladz-tracking.zip (the button above)
2. WordPress: Plugins → Add New → Upload Plugin → choose halaladz-tracking.zip → Install Now → Activate
3. Settings → HalalAdz Tracking → paste your pixel id (hzp_123_AbCdEfGhIjKl)
4. Optional: paste a server key (hzk_...) so orders are also sent from your server

Shopify

For a Shopify store today: send your orders from your server, as in part 3 below (the order number makes each order count once). There is no HalalAdz app in the Shopify App Store yet; an official one is planned, and its install link will be added here when it is published.

Google Tag Manager

Download our template and import it, then create a tag with your pixel id.

Download the template (halaladz-gtm-template.tpl)

Check the file is complete: SHA-256 · SHA256SUMS.txt
a4b18ff353f4bda889a84c2a5cdc87a4b620be132786f8663bd020145e6f9c0f  halaladz-gtm-template.tpl
Installing in Tag Manager
1. Download halaladz-gtm-template.tpl (the button above)
2. Google Tag Manager → Templates → Tag templates → New → ⋮ → Import
3. Choose halaladz-gtm-template.tpl → Save
4. Tags → New → HalalAdz Pixel → Pixel id: hzp_123_AbCdEfGhIjKl
5. Event: Page view on All Pages; Order on your thank-you page with value, currency, eventId

3. Server-to-server

This path works even when browsers block cookies. The landing address of our link carries hz_click_id: keep it with the order on your server and send it when the order is placed. Create the key (hzk_…) in the dashboard settings; never put it in a web page.

curl
curl -X POST https://api.halaladz.com/v1/conversions \
  -H "X-Api-Key: $HALALADZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "purchase",
    "clickId": "<hz_click_id you saved with the order>",
    "valueMicros": "1499500000",
    "currency": "BDT",
    "eventId": "ORDER-1234"
  }'
Node.js
// Node 18+: send the order from your server (no cookies needed)
await fetch("https://api.halaladz.com/v1/conversions", {
  method: "POST",
  headers: { "X-Api-Key": process.env.HALALADZ_API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    kind: "purchase",
    clickId: order.hzClickId,       // hz_click_id from the landing address
    valueMicros: "1499500000",      // 1499.50 in micros (string)
    currency: "BDT",
    eventId: order.id,              // same id as the pixel: counted once
  }),
});
PHP
<?php
$body = json_encode([
  'kind' => 'purchase',
  'clickId' => $order['hz_click_id'],
  'valueMicros' => '1499500000',
  'currency' => 'BDT',
  'eventId' => $order['id'],
]);
$ch = curl_init('https://api.halaladz.com/v1/conversions');
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ['X-Api-Key: ' . getenv('HALALADZ_API_KEY'), 'Content-Type: application/json'],
  CURLOPT_POSTFIELDS => $body,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_TIMEOUT => 5,
]);
curl_exec($ch);
Python
import os, requests

requests.post(
    "https://api.halaladz.com/v1/conversions",
    headers={"X-Api-Key": os.environ["HALALADZ_API_KEY"]},
    json={
        "kind": "purchase",
        "clickId": order["hz_click_id"],
        "valueMicros": "1499500000",
        "currency": "BDT",
        "eventId": order["id"],
    },
    timeout=5,
)

Running the pixel and the server together? Send the same eventId from both. The first one counts, the second is a duplicate.

Responses
201 {"id": 42, "attributedBy": "click" | "view" | "none", "review": "ok" | "pending", "flags": [...]}
200 {"duplicate": true}       the same eventId was already counted (pixel or server)
202 {"attributed": false}     no HalalAdz click or view inside the window
400 wrong field · 401 wrong key · 404 unknown campaign · 422 click of another campaign · 429 too many

4. Apps: Android, iOS, Flutter, React Native

Add our small kit to your app. It counts installs and app opens by itself. For a sign-up and an order you add one line each: the amount, the currency code and your order number. Without internet the kit keeps the events and sends them later; the same order number counts once. Your pixel ID is on the setup page in the dashboard.

Android

Add the kit
// app/build.gradle.kts
dependencies {
    implementation("com.halaladz:halaladz-sdk:0.1.0")
}
Start it, then sign-up and order
import com.halaladz.sdk.HalalAdz
import com.halaladz.sdk.core.AppEvent

class App : Application() {
    override fun onCreate() {
        super.onCreate()
        // install (Google Play Install Referrer) + app opens: automatic
        HalalAdz.startTracking(this, "hzp_123_AbCdEfGhIjKl")
    }
}

// sign up and order (any ISO 4217 currency, your order number as eventId)
HalalAdz.track(AppEvent.SIGN_UP)
HalalAdz.track(AppEvent.ORDER, amount = "1250.50", currency = "BDT", eventId = "ORDER-1001")
Countries where consent comes first
// countries where consent comes first (EU, UK and others)
HalalAdz.startTracking(this, "hzp_123_AbCdEfGhIjKl", requireConsent = true)
HalalAdz.setTrackingConsent(true)   // after the person agreed

iOS

Start it, then sign-up and order
import HalalAdzSDK

// application(_:didFinishLaunchingWithOptions:)
// install (Apple SKAdNetwork / AdAttributionKit) + app opens: automatic
try HalalAdz.startTracking(pixelId: "hzp_123_AbCdEfGhIjKl")

// SwiftUI: links that open the app
.onOpenURL { HalalAdz.handleOpenURL($0) }

try HalalAdz.track(.signUp)
try HalalAdz.track(.order, amount: "1250.50", currency: "BDT", eventId: "ORDER-1001")

Add the two keys below to Info.plist and type your App Store app number on the setup page. Apple then sends its own signed results to us, and we check the signature with Apple's own keys.

Info.plist
<!-- Info.plist: Apple sends its signed results (postbacks) to
     https://halaladz.com/.well-known/skadnetwork/report-attribution/
     https://halaladz.com/.well-known/appattribution/report-attribution/ -->
<key>NSAdvertisingAttributionReportEndpoint</key>
<string>https://halaladz.com</string>
<key>AdAttributionKit</key>
<dict>
  <key>AttributionCopyEndpoint</key>
  <string>https://halaladz.com</string>
</dict>

Flutter

Add to pubspec.yaml, start it, then sign-up and order
# pubspec.yaml
dependencies:
  halaladz: ^0.1.0

// Dart
import 'package:halaladz/halaladz.dart';

await HalalAdz.startTracking('hzp_123_AbCdEfGhIjKl');
await HalalAdz.track(AppEvent.signUp);
await HalalAdz.track(AppEvent.order, amount: '1250.50', currency: 'BDT', eventId: 'ORDER-1001');

React Native

Install, start it, then sign-up and order
npm install @halaladz/react-native   # then: cd ios && pod install

import { HalalAdz } from '@halaladz/react-native';

await HalalAdz.startTracking('hzp_123_AbCdEfGhIjKl');
await HalalAdz.track('signup');
await HalalAdz.track('order', { amount: '1250.50', currency: 'BDT', eventId: 'ORDER-1001' });

From your app's server

Sending with a server key
# from your app's server (server key), with the click id your app got after the install
curl -X POST https://api.halaladz.com/v1/conversions \
  -H "X-Api-Key: $HALALADZ_API_KEY" -H "Content-Type: application/json" \
  -d '{"kind": "install", "from": "app", "clickId": "<hz_click_id>", "eventId": "install-1"}'
# kind: install | open | signup | order  (open only marks the app as connected)
What the kits send
# what the kits send (you do not need to write this)
POST https://api.halaladz.com/v1/px
{"pid": "hzp_123_AbCdEfGhIjKl", "ev": "order", "click": "<hz_click_id>",
 "value": "1250500000", "cur": "BDT", "eid": "ORDER-1001", "src": "app"}

How installs are found

  • Android: when your ad goes to Google Play, our link puts an anonymous click number inside Play's own referrer field. After the install the kit reads it once from Google's official Play Install Referrer API.
  • iOS: Apple's own SKAdNetwork and AdAttributionKit. The kit only tells Apple whether the app was opened, a sign-up or an order happened; a day or two later Apple sends totals without saying who installed.
  • On iOS a click number from a link is kept only when the person allowed tracking or said yes in your consent screen.
  • Never the advertising ID (GAID or IDFA) and never any hidden way of recognising a phone. No names, phone numbers or e-mails.
The click number in a Google Play link
# your ad's link to Google Play
https://play.google.com/store/apps/details?id=com.example.shop
# what HalalAdz opens (the click id goes inside Play's referrer)
https://play.google.com/store/apps/details?id=com.example.shop&hz_click_id=<id>&referrer=hz_click_id%3D<id>

5. No website? Facebook pages, WhatsApp, Telegram sellers

  • Coupon codes: in Conversions → Promo codes press “Make codes for every creator”. Each creator gets their own code per campaign; you can edit a code as long as it has no orders.
  • Logging an order: when a buyer says or types a code, log the order with the code and amount in the dashboard. The same order number never counts twice.
  • Orders logged this way are shown apart as “Self reported” in reports and weigh less in the creator's quality score (the admin sets how much).
  • WhatsApp link: add your WhatsApp number on the setup page. Creators share the link below; a tap opens a chat with you with the code filled in, and each person counts once a day.
WhatsApp link (with the code)
https://api.halaladz.com/v1/go/wa/HZHALA7KQ2MX
Logging an order (the dashboard sends this)
POST https://api.halaladz.com/v1/tracking/manual-orders   (the dashboard does this for you)
{"campaignId": 123, "code": "HZHALA7KQ2MX", "orderId": "FB-1001", "valueMicros": "1500000000", "currency": "BDT"}

6. Which ad gets the order, and privacy

  • Our tracking link adds an anonymous click id (hz_click_id) to the address.
  • An order within 7 days after a click, or 1 day after a view, belongs to the ad. The admin can change these windows.
  • When someone clicked several HalalAdz ads, the last click wins.
  • No names, phone numbers, e-mails or other personal data, ever. Only a first-party id on your own site, no third-party cookies.

7. Fraud checks

  • The pixel id carries a secret signature: nobody can guess another advertiser's id.
  • List your sites on the setup page and events from other sites are not counted.
  • Server events need your key, and a click must belong to your campaign.
  • Orders without a click, sudden bursts and repeated order ids go to the admin review queue; rejected ones leave the reports.

8. Testing

Press “Send test order” on the setup page: when everything is connected, the last event time changes at once. Test orders are never counted and never charged. From your server, add test: true.

Test from your server
curl -X POST https://api.halaladz.com/v1/conversions \
  -H "X-Api-Key: $HALALADZ_API_KEY" -H "Content-Type: application/json" \
  -d '{"campaignId": 123, "kind": "purchase", "test": true}'

9. Billing does not change

Counting orders only shows results. Campaigns with the Orders goal still pay per real, verified click, as before. Fake clicks are never charged.

Start the setup in your dashboard