Integration Guide

One universal snippet for both your hotel website and Avvio booking engine.

Use the same code on every page. On booking engine pages the Avvio adapter auto-detects and captures events automatically. On hotel website pages the adapter detection is a no-op — no performance cost, no errors.

Quick Start Script Tag

Add this snippet to every page — hotel website and booking engine — before the closing </body> tag:

<script src="https://cdn.achooo.io/v1/achooo.min.js"></script>
<script>
  (function() {
    var achooo = Achooo.createAchooo({
      hotelId: 'YOUR_HOTEL_ID', // e.g. 'htl_kR7mNx9pQ2wS'
      ingestEndpoint: 'https://api.achooo.io',
      handoffEndpoint: 'https://handoff.achooo.io',
      adapterAutoDetect: true
    });
    achooo.init();
    window.achooo = achooo; // expose for optional manual tracking
  })();
</script>

The IIFE bundle exposes a global Achooo object with a createAchooo factory function. Setting adapterAutoDetect: true is safe on all pages.

NPM Installation NPM

npm install @achooo/sdk
import { createAchooo } from '@achooo/sdk';

const achooo = createAchooo({
  hotelId: 'htl_kR7mNx9pQ2wS',
  ingestEndpoint: 'https://api.achooo.io',
  handoffEndpoint: 'https://handoff.achooo.io',
  adapterAutoDetect: true,
});

achooo.init();

Configuration Reference

FieldTypeRequiredDefaultDescription
hotelIdstringYes-Opaque hotel identifier (provided by Achooo, e.g. htl_kR7mNx9pQ2wS)
ingestEndpointstringYes-Events ingestion service URL
handoffEndpointstringYes-Cross-domain identity handoff service URL
apiKeystringNonullAPI key for ingest authentication (provided by Achooo)
debugbooleanNofalseEnable verbose console logging for SDK and adapter activity
batchSizenumberNo25Number of events to buffer before flushing
flushIntervalMsnumberNo5000Periodic flush interval in milliseconds
sessionTimeoutMsnumberNo1800000Session expiry duration (default: 30 min)
adapterAutoDetectbooleanNotrueAuto-detect the booking engine adapter
adapterNamestringNonullForce a specific adapter (e.g., "avvio")
bookingEngineDomainstringNonullExplicit booking engine hostname for guaranteed cross-domain handoff (e.g., secure.yourhotel.com)
hashSaltstringNohotelIdPer-hotel salt for surname hashing (privacy)

Dynamic Hotel ID

Each hotel property has a unique opaque hotelId assigned by Achooo (e.g. htl_kR7mNx9pQ2wS). If you manage multiple properties, set it dynamically from your per-hotel configuration:

(function() {
  var achooo = Achooo.createAchooo({
    hotelId: window.HOTEL_CONFIG.achoooHotelId,
    ingestEndpoint: 'https://api.achooo.io',
    handoffEndpoint: 'https://handoff.achooo.io',
    adapterAutoDetect: true
  });
  achooo.init();
  window.achooo = achooo;
})();

If you inject configuration server-side, you can also template the hotel ID directly:

(function() {
  var achooo = Achooo.createAchooo({
    hotelId: '{{hotel.achooo_id}}',
    ingestEndpoint: 'https://api.achooo.io',
    handoffEndpoint: 'https://handoff.achooo.io',
    adapterAutoDetect: true
  });
  achooo.init();
  window.achooo = achooo;
})();

How the Adapter Works

The Achooo SDK includes a built-in Avvio adapter that automatically detects when it's running on an Avvio booking engine page. On non-Avvio pages (hotel website), the detection is a fast synchronous check that immediately skips — no performance cost, no errors, no extra network calls.

Auto-Detection

The adapter uses a scoring system to detect Avvio pages:

Detection runs automatically on init(). You can force the adapter with adapterName: "avvio" if auto-detection doesn't activate on a non-standard page.

Capture Strategy

  1. Network interception (preferred) — Intercepts fetch() and XMLHttpRequest calls to Avvio API endpoints. Captures the richest data directly from API payloads.
  2. DOM observation (fallback) — Watches for booking confirmation elements in the DOM if network interception doesn't capture expected events.

API Patterns Monitored

CategoryURL Patterns
Availability / Search/api/availability, /search, /rates, /checkavailability
Booking/api/booking, /reservation, /confirm
Cancellation/api/cancel, /cancellation

Cross-Domain Handoff

When a guest navigates from a hotel website to the Avvio booking engine, the SDK stitches the session across domains:

  1. Hotel website SDK calls /handoff/mint to get a signed token containing the guest's anonymous identity
  2. The token is appended to the booking engine URL as a query parameter
  3. Booking engine SDK calls /handoff/consume to recover the stitched identity
  4. The guest's journey is tracked as a single continuous session
This happens automatically when both the hotel website and booking engine have the SDK installed with the same hotelId.

Events Captured

The Avvio adapter automatically captures these events:

EventTriggerKey Data
page_viewEvery page loadURL, referrer, title
page_dwellPage unloadTime spent on page
date_searchAvailability searchCheck-in/out dates, guests, rooms
rate_quoteRate displayed to guestRoom type, rate plan, amount, currency
funnel_stepBooking funnel progressionStep name, step number, time on previous step
booking_createdBooking confirmedConfirmation number, surname (hashed), dates, amount
booking_cancelledBooking cancelledConfirmation number, surname (hashed), reason
booking_modifiedBooking modifiedModification type, original vs new values

All surname data is hashed with PBKDF2 using the per-hotel salt before transmission. No PII is stored.

Testing & Verification

Enable Debug Mode

Set debug: true in the SDK config to enable verbose console logging:

(function() {
  var achooo = Achooo.createAchooo({
    hotelId: 'htl_kR7mNx9pQ2wS',
    ingestEndpoint: 'https://api.achooo.io',
    handoffEndpoint: 'https://handoff.achooo.io',
    adapterAutoDetect: true,
    debug: true
  });
  achooo.init();
  window.achooo = achooo;
})();

With debug mode on, you'll see console output for:

Adapter Health Check

After initialization, check the adapter's health status in the browser console:

console.log(achooo.getAdapterHealth());
// { status: 'healthy', confidence: 'HIGH', capturedEvents: 5, lastCaptureAt: '...', issues: [] }

Health statuses:

Network Inspection

Open browser DevTools (Network tab) and look for requests to:

Verify the Script Loaded

// In the browser console:
console.log(typeof Achooo.createAchooo); // "function"

Troubleshooting

SymptomLikely CauseSolution
Achooo is not definedScript failed to loadCheck the script URL, network tab for 404s
Adapter not detectedNon-standard Avvio pageSet adapterName: "avvio" to force activation
No events in dashboardWrong hotelId or ingestEndpointVerify config values, check debug console output
Cross-domain handoff failingMismatched hotelId between sitesEnsure both sites use the same hotelId
Events not capturedAd blocker or CSP blockingCheck for blocked network requests in DevTools