Configuration

SharePush Web SDK — Configuration Reference

Every option you can pass to Sharepush.init(): type, default value, and what it controls — core settings, prompts, PWA install, and the in-app bridge.

Configuration Reference

Everything is configured through a single Sharepush.init({ ... }) call. All options are optional except apiUrl and apiKey. Unknown options are ignored.

 1Sharepush.init({ /* options below */ });

#Core / required

Option Type Default Description
apiUrl string — (required) Base URL of the SharePush API, e.g. https://api.sharepush.io. A trailing slash is stripped automatically.
apiKey string — (required) Your site token (starts with st_). Identifies which site the subscriber/events belong to.
serviceWorkerPath string '/sharepush-sw.js' Path (on your origin) to the service-worker file. Must be reachable and scoped to your site root.
autoPrompt boolean false If true, the push opt-in prompt is scheduled automatically. If false, nothing is shown until you trigger it yourself.
useBounce boolean true Enables the "ghost referrer" bounce so click-throughs reach your page as direct traffic (clean attribution). See Event Tracking.
legacyMigrationMode boolean false If true, existing (legacy) subscribers are unsubscribed and re-subscribed on next visit. Use only during a migration.

Note: vapidPublicKey and the Firebase keys are required internally but are injected by /api/v1/sdk.js — you never set them in your init() call.


#Identity & segmentation

Option Type Default Description
category string 'general' Segments subscribers and events into a group (e.g. news, sports). Used for targeted campaigns.
customKey string '' Your own identifier for the visitor (e.g. a user ID, or 'Guest' for anonymous).
email string | null null Optional email to associate with the subscriber.
phone_number (alias phoneNumber) string | null null Optional phone number to associate with the subscriber.
props object {} Arbitrary key/value metadata attached to every tracked event (e.g. article_id, author_id). Values should be a flat object.

#Appearance & language

Option Type Default Description
language string 'en' UI language for all prompts. One of en, it, es, fr, de. Unknown values fall back to en.
theme string 'dark' Visual style of the modals. One of light, dark, glass-light, glass-dark (aliases like glasslight are accepted).

See Triggers, Theming & Localization for details.


#Push notification prompt

Controls the "Allow notifications?" opt-in. Full behavior in Push Notification Prompt.

Option Type Default Description
promptTitle string localized Headline of the prompt.
promptMessage string localized Body copy of the prompt.
promptButtonAllow string localized (Allow) Label of the accept button.
promptButtonDeny string localized (Not now) Label of the dismiss button.
promptBrandColor string (hex) '#0d9488' Accent color for buttons/branding.
promptIcon string (URL) null Icon shown in the prompt.
delay number (ms) 3000 Delay before the prompt appears (when trigger.type is delay).
promptTrigger object { type:'delay', delay:3000, scrollDepth:35 } When to show the prompt. See Triggers.
useSecondStep boolean true If true, dismissing the prompt shows a confirmation "Are you sure?" step.
secondStepTitle string localized Title of the confirmation step.
secondStepMessage string localized Message of the confirmation step.

#PWA install prompt

Controls the "Install this app" invite. Full behavior in PWA Install Prompt.

Option Type Default Description
pwaPromptEnabled boolean true Master switch for the install prompt.
pwaPromptPlatforms object | array all true Per-platform targeting. Keys: ios, android, windows, mac, desktop. Object form ({ ios:false }) disables specific platforms; array form (['android','mac']) is a strict allowlist. desktop is the catch-all for Linux/ChromeOS.
pwaPromptDelay number (ms) 4500 Delay before the install prompt appears.
pwaPromptTrigger object { type:'delay', delay:4500, scrollDepth:35 } When to show the install prompt.
pwaPromptDismissDays number 7 Cooldown (days) before re-showing after a dismissal.
pwaPromptTitle string localized (Install this app) Headline.
pwaPromptMessage string localized Body copy (non-iOS).
pwaPromptIosMessage string localized Body copy shown on iOS (Add to Home Screen guidance).
pwaPromptAllowText string localized (Install) Accept button label.
pwaPromptDenyText string localized (Not now) Dismiss button label.

#In-app browser bridge

Shown when a visitor is inside an in-app webview (Instagram, Facebook, etc.) that can't reliably do web push. Full behavior in In-App Browser Bridge.

Option Type Default Description
inAppBridgeEnabled boolean true Master switch for the bridge prompt.
inAppBridgeDelay number (ms) 250 Delay before the bridge appears.
inAppBridgeTrigger object { type:'delay', delay:250, scrollDepth:20 } When to show the bridge.
inAppBridgeDismissHours number 12 Cooldown (hours) before re-showing after a dismissal.
inAppBridgeTitle string localized Headline.
inAppBridgeMessage string localized Body copy ("open in Safari/Chrome").
inAppBridgeAllowText string localized (Got it) Primary button label.
inAppBridgeDenyText string localized (Continue here) Dismiss button label.

#Trigger object shape

Any *Trigger option accepts:

 1{
 2  type: 'delay' | 'scroll-depth',  // aliases: 'scroll', 'scroll_depth'
 3  delay: 3000,                     // ms (used for 'delay', and as fallback for scroll)
 4  scrollDepth: 35                  // percent 0–100 (used for 'scroll-depth')
 5}
  • delay — show after N milliseconds.
  • scroll-depth — show once the user scrolls past scrollDepth% of the page. If the page isn't scrollable, it falls back to the delay timer.

Next: Push Notification Prompt →