Configuration
Simple configuration example.
Basic Configuration
Section titled “Basic Configuration”import { Initializer } from '@segmentify/integration';
new Initializer({ domain: 'your-domain.com', apiKey: 'your-api-key', language: 'EN', currency: 'USD', spa: false, segmentifyApiUrl: '//your-api.segmentify.com',});Configuration Reference
Section titled “Configuration Reference”| Property | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | Your website domain |
apiKey | string | Yes | Your Segmentify API key |
language | string | Yes | Language code (e.g., 'EN', 'TR') |
currency | string | Yes | Currency code (e.g., 'USD', 'EUR') |
spa | boolean | Yes | Enable SPA mode for client-side routing |
segmentifyApiUrl | string | Yes | Segmentify API endpoint URL |
segmentifyPushUrl | string | No | Custom push endpoint URL |
debug | boolean | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | No | Enable debug logging — see Logger |
searchify | boolean | No | Enable Searchify integration |
ga | object | No | Google Analytics config (see below) |
pageMap | PageMap | No | Page type mapping — see Page Mapping |
doNotPersonalize | object | No | Opt-out callback (see below) |
allPageLogic | object | No | Global pre/post execute — see Page Mapping |
user | User | No | Pre-set user info — see User Identification |
Google Analytics
Section titled “Google Analytics”new Initializer({ // ...required fields ga: { enabled: true, ga4: true, // true for GA4, false for Universal Analytics },});Do Not Personalize
Section titled “Do Not Personalize”Provide a callback that returns true to opt out of personalization:
new Initializer({ // ...required fields doNotPersonalize: { cb: () => !hasConsent(), // e.g., check GDPR preferences },});Initialization Behavior
Section titled “Initialization Behavior”- Calling
new Initializer()twice logs a warning and skips the second call. - The Segmentify SDK script is loaded asynchronously after DOM ready.
- Any events queued from the previous page are drained automatically.