Auto-initializing MindBody/Healcode integration for websites with link interception and branded web widgets.
npm install @renessence/webAuto-initializing MindBody/Healcode integration for websites. Simply include the script and configure – link interception and modal management work automatically.
``html`
`bash`
pnpm add @renessence/web
Add the script to your HTML and configure via an inline script:
`html`
Buy 5x Floating Package
Member Login
| Option | Type | Description |
|--------|------|-------------|
| siteId | string | Your MindBody site ID (healcode site) |mbSiteId
| | string | Your MindBody business ID |
| Option | Type | Description |
|--------|------|-------------|
| interceptNamespaces | string[] | URL path prefixes to intercept (e.g., ['/buy', '/login']) |simplePatterns
| | Record | Exact URL to modal type mapping |dynamicPatterns
| | DynamicPattern[] | Regex patterns for extracting IDs from URLs |itemIdMap
| | Record | Map slugs to MindBody item IDs |
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| trackingParams | boolean | false | Forward URL parameters (UTM, gclid, fbclid, _ga, _gl) to Healcode |
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| scrollOffsetClass | string | undefined | CSS class to calculate fixed header offset |identitySite
| | boolean | Auto-detected | Override auto-detection of MindBody Identity enablement (rarely needed) |debug
| | boolean | false | Enable debug logging for initialization and modal interactions |initTimeoutMs
| | number | 20000 | Maximum time to wait for vendor script initialization (ms) |modalTimeoutMs
| | number | 20000 | Maximum time to wait for modal system readiness (ms) |onIntercept
| | function | undefined | Hook called when a link is intercepted; return false to cancel, or a Promise to defer opening |
The library supports intercepting these MindBody link types:
- login - Member login modal
- register - New member registration
- account - Member account management
- cart - Shopping cart
- pricing - Service/package pricing (requires itemId)gift-card
- - Gift card purchase (requires itemId)contract
- - Contract enrollment (requires itemId)
Direct URL to modal mapping:
`javascript`
simplePatterns: {
'/login': { type: 'login' },
'/register': { type: 'register' },
'/account': { type: 'account' },
'/cart': { type: 'cart' },
}
Extract IDs from URL paths:
`javascript`
dynamicPatterns: [
{
// Matches: /buy/packages/anything
// Extracts: "anything" as slug
pattern: /^\/buy\/packages\/(.+)$/,
type: 'pricing',
itemType: 'service',
},
{
// Matches: /buy/contracts/membership-gold
// Extracts: "membership-gold" as slug
pattern: /^\/buy\/contracts\/(.+)$/,
type: 'contract',
itemType: 'contract',
},
]
Convert friendly slugs to MindBody IDs:
`javascript`
itemIdMap: {
'5x-floating': '100014',
'membership-gold': '200045',
'gift-card-50-eur': '100115',
}
Result: Clicking /buy/packages/5x-floating opens the pricing modal for item 100014.
When trackingParams: true, these parameters are forwarded to Healcode URLs:
- UTM Parameters: utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_idgclid
- Google Ads: , gbraid, wbraidfbclid
- Facebook Ads: _ga
- Google Analytics: , _gl
This ensures analytics consistency across your site and MindBody.
1. Script loads and calls initializeHealcode() automatically
2. Detects any embedded Healcode widgets on the page
3. Sets up link interception based on your config
4. Clicks on matching links open modals instead of navigating
5. Tracking parameters are preserved for attribution
Modern browsers with ES2020+ support (Chrome 80+, Firefox 72+, Safari 13.1+, Edge 80+).
For more control (manual initialization, widget creation, TypeScript), use the lower-level mindbody-inject` package.
PolyForm Noncommercial License 1.0.0
Free for non-commercial use. Commercial use exclusively licensed to Renessence B.V.
- Issues: GitHub Issues
- Documentation: Full API Docs