Skip to content

Configuration

Simple configuration example.

View as Markdown llms.txt
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',
});
PropertyTypeRequiredDescription
domainstringYesYour website domain
apiKeystringYesYour Segmentify API key
languagestringYesLanguage code (e.g., 'EN', 'TR')
currencystringYesCurrency code (e.g., 'USD', 'EUR')
spabooleanYesEnable SPA mode for client-side routing
segmentifyApiUrlstringYesSegmentify API endpoint URL
segmentifyPushUrlstringNoCustom push endpoint URL
debugboolean | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'NoEnable debug logging — see Logger
searchifybooleanNoEnable Searchify integration
gaobjectNoGoogle Analytics config (see below)
pageMapPageMapNoPage type mapping — see Page Mapping
doNotPersonalizeobjectNoOpt-out callback (see below)
allPageLogicobjectNoGlobal pre/post execute — see Page Mapping
userUserNoPre-set user info — see User Identification
new Initializer({
// ...required fields
ga: {
enabled: true,
ga4: true, // true for GA4, false for Universal Analytics
},
});

Provide a callback that returns true to opt out of personalization:

new Initializer({
// ...required fields
doNotPersonalize: {
cb: () => !hasConsent(), // e.g., check GDPR preferences
},
});
  • 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.