The tag: a reference
API reference for houseads.js: pageviews, conversions, order values, queue handling, and SPAs.
1. What the measurement SDK does
The houseads.js measurement script is a lightweight, first-party JavaScript library that collects website traffic analytics and reports conversion events.
What it does: Tracks pageviews, active session duration, visitor counts, and post-click conversions without third-party tracking cookies or cross-site data sharing.
Why use it: To understand your website audience traffic and evaluate the true Return on Ad Spend (ROAS) of your advertising campaigns.
Who needs it: Website owners running first-party analytics and advertisers tracking campaign conversions.
What must already be configured: A verified website in your dashboard and your data-measurement-id attribute.
What happens after setup: Real-time traffic begins displaying under Website Analytics and Campaign ROI reports.
Include the script in the <head> of your website. The snippet initializes an asynchronous queue stub, allowing your code to call tracking methods immediately before the script finishes loading without throwing errors.
SDK embed tag
<script async fetchpriority="low" src="https://api.adservekit.com/houseads.js" data-measurement-id="G-XXXXXXXXXX"></script>2. JavaScript API methods
- houseAds.track(eventName, parameters): Dispatches an analytical event or standard conversion (signup, lead, subscribe, add_to_cart, checkout, purchase).
- houseAds.purchase(orderPayload): Records an ecommerce purchase with transactionId, value, and currency.
- houseAds.pageView(path): Manually records a pageview (essential for Single-Page Applications).
- houseAds.debug(): Prints current SDK session state and attribution tokens to the browser console.
Core tracking examples
// Track a sign-up
window.houseAds.track("signup", { plan: "pro" });
// Track an ecommerce purchase
window.houseAds.purchase({
transactionId: "ORD-1002",
value: 75.00,
currency: "USD",
items: 1
});
// Manual pageview for SPA routing
window.houseAds.pageView("/pricing");3. Asynchronous queue and array format
If you use Google Tag Manager or external script runners, you can push commands into the queue array:
window.houseAds = window.houseAds || []; window.houseAds.push(['track', 'signup']);
4. Single-Page Applications (SPA)
In frameworks like React, Vue, or Next.js where navigation occurs without full page reloads, trigger houseAds.pageView() after each client-side route transition completes.
The SDK automatically debounces consecutive history events firing within 60ms to prevent duplicate pageviews.
5. Cookieless privacy mode
When a browser emits Global Privacy Control (GPC) or Do Not Track (DNT) signals, the SDK operates in cookieless mode: visits and conversions are counted, but persistent visitor identifiers are omitted.
6. Script separation: ad.js vs. houseads.js
ad.js is the ad delivery loader that renders advertisements in your slots.
houseads.js is the measurement tag that tracks pageviews, sessions, and conversions.
They are independent scripts that do not interfere with each other. A site serving ads installs ad.js; a site wanting analytics installs houseads.js; a site wanting both installs both.