Configuration
SharePush Web SDK — Triggers, Theming & Localization
Control when prompts appear (delay vs scroll-depth), pick a visual theme, and localize all prompt copy across five supported languages.
Triggers, Theming & Localization
#Triggers — when prompts appear
Each prompt has its own independent trigger: promptTrigger (push notification), pwaPromptTrigger (PWA install), and inAppBridgeTrigger (in-app browser bridge). A trigger is an object:
1{
2 type: 'delay' | 'scroll-depth',
3 delay: 3000, // ms
4 scrollDepth: 35 // percent (0–100)
5}
Accepted type aliases: scroll, scroll_depth, scrolldepth all normalize to scroll-depth.
#Delay trigger (default)
Shows the prompt after a fixed time:
1Sharepush.init({
2 delay: 4000, // shortcut for the push prompt
3 pwaPromptTrigger: { type: 'delay', delay: 8000 }
4});
#Scroll-depth trigger
Shows the prompt once the visitor scrolls past a percentage of the page — a good "engaged reader" signal:
1Sharepush.init({
2 promptTrigger: { type: 'scroll-depth', scrollDepth: 50 }
3});
If the page is too short to scroll, the SDK automatically falls back to the delay timer so the prompt still appears.
#Default timings
| Prompt | Default trigger |
|---|---|
| Push | delay, 3000 ms |
| PWA install | delay, 4500 ms |
| In-app bridge | delay, 250 ms |
#A trigger is a timing rule, not a forced display
Reaching the timer or scroll threshold does not force a modal open — the SDK still checks eligibility first, so a trigger only decides when to attempt the prompt:
- The push prompt opens only if notification permission is still in the
defaultstate. - The PWA install prompt opens only if the app isn't already installed and the prompt is eligible.
- The in-app bridge opens only inside a supported in-app browser context.
For scroll-depth triggers, the SDK also throttles scroll/resize checks internally, and falls back to the delay timer when the page isn't actually scrollable.
#Backward compatibility with legacy delay options
Older integrations using delay, pwaPromptDelay, or inAppBridgeDelay keep working — those values are converted internally into the new trigger objects. For new setups prefer the explicit trigger objects, and when you use scroll-depth, always define a delay too so the short-page fallback stays predictable.
#Theming
Set theme to one of four styles:
| Value | Look |
|---|---|
dark (default) |
Solid dark surface |
light |
Solid light surface |
glass-dark |
Frosted-glass dark |
glass-light |
Frosted-glass light |
1Sharepush.init({ theme: 'glass-light' });
Aliases like glasslight, glass_light, glassdark are accepted. Set your accent with promptBrandColor (hex). All UI renders inside a Shadow DOM, so it won't inherit or leak your site's styles.
#Localization
Set language to one of the five supported locales. All prompt copy (push, PWA, bridge, and the second-step confirmation) uses built-in translations for that language:
| Code | Language |
|---|---|
en |
English (default) |
it |
Italian |
es |
Spanish |
fr |
French |
de |
German |
1Sharepush.init({ language: 'it' });
Unknown language codes fall back to English. You can always override individual strings (promptTitle, pwaPromptMessage, etc.) regardless of language — your explicit copy wins over the localized default.
1Sharepush.init({
2 language: 'fr',
3 promptTitle: 'Restez informé', // overrides the French default title
4});