Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
dc4cd9b
feat(campaign): create types
Parvinmh Oct 1, 2025
5d701c3
add json file for some type
Parvinmh Oct 2, 2025
2f11b71
fix errors
Parvinmh Nov 25, 2025
bc638ee
create example for load campaign in json file and manually
Parvinmh Nov 25, 2025
1ca0d2f
add example for idle user
Parvinmh Nov 28, 2025
49c40b2
Merge remote-tracking branch 'upstream/master' into campaign
Parvinmh Jan 13, 2026
246e805
refactor(campaign): refactor campaign system architecture
Parvinmh Jan 14, 2026
9d28700
seperate triggers to make the testing easier
Parvinmh Jan 14, 2026
57b32ac
fix(campaign): remove unnecessary async from sync-only methods
Parvinmh May 13, 2026
3c1c3bb
fix(campaign/trigger): element_click misses clicks on child elements
Parvinmh May 13, 2026
f91209a
fix(campaign/trigger): element_hover rewrite with closest(), hoverDur…
Parvinmh May 13, 2026
8ced793
fix(campaign/trigger): elementVisible fires twice when element is in …
Parvinmh May 13, 2026
6035902
fix(campaign/trigger): sessionCount used wrong localStorage key and d…
Parvinmh May 13, 2026
56193e6
fix(campaign/trigger): returningUser had inverted first-visit logic a…
Parvinmh May 13, 2026
bb65db3
fix(campaign/trigger): idleUser does not pause timer when tab is hidden
Parvinmh May 13, 2026
097e68c
fix(campaign/trigger): exitIntent hardcoded threshold to 0, ignoring …
Parvinmh May 13, 2026
766ff43
fix(campaign/trigger): formInteraction ignores interactionType and fo…
Parvinmh May 13, 2026
1b2743a
fix(campaign/trigger): division by zero in scrollDepth and scrollToEl…
Parvinmh May 13, 2026
4dd8c3f
fix(campaign/trigger): urlMatch throws on invalid regex pattern
Parvinmh May 13, 2026
3d32cdd
refactor(campaign): remove unused types, methods, and state
Parvinmh May 13, 2026
47aa2ef
fix(campaign): ExperienceFactory — never exhaustiveness check, direct…
Parvinmh May 13, 2026
fd52b02
fix(examples/campaign): rewrite index.html and fix tourOptions in exi…
Parvinmh May 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
637 changes: 637 additions & 0 deletions docs/campaign-system.md

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions example/campaigns/element-click-tour.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": "1.0.0",
"campaigns": [
{
"id": "feature-discovery",
"name": "Feature Discovery Tour",
"description": "Tour that starts when user clicks on a specific element",
"active": true,
"mode": "tour",
"triggers": [
{
"type": "element_click",
"selector": ".help-button",
"delay": 500
}
],
"frequency": {
"type": "session"
},
"tourOptions": {
"steps": [
{
"element": ".feature-panel",
"intro": "This is our main feature panel where you can access advanced tools.",
"position": "left"
},
{
"element": ".settings-icon",
"intro": "Click here to customize your preferences.",
"position": "bottom"
},
{
"element": ".export-button",
"intro": "Use this button to export your data in various formats.",
"position": "top"
}
],
"showProgress": true,
"showBullets": false
}
}
]
}
40 changes: 40 additions & 0 deletions example/campaigns/exit-intent-promotion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"version": "1.0.0",
"campaigns": [
{
"id": "exit-intent-promotion",
"name": "Exit Intent - Special Offer",
"description": "Show special offer when user tries to leave the page",
"active": true,
"mode": "tour",
"triggers": [
{
"type": "exit_intent",
"sensitivity": 10
}
],
"frequency": {
"type": "once"
},
"tourOptions": {
"steps": [
{
"intro": "<h3>Wait! Don't leave yet!</h3><p>We have a special offer just for you. Get 20% off your first purchase!</p>",
"position": "floating"
},
{
"element": ".promo-code",
"intro": "Use code <strong>WELCOME20</strong> at checkout to get your discount.",
"position": "bottom"
}
],
"exitOnEsc": true,
"exitOnOverlayClick": true
},
"analytics": {
"trackViews": true,
"trackCompletions": true
}
}
]
}
52 changes: 52 additions & 0 deletions example/campaigns/first-visit-tour.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"version": "1.0.0",
"campaigns": [
{
"id": "welcome-tour",
"name": "Welcome Tour - First Visit",
"description": "A welcome tour that appears when a user visits the site for the first time",
"active": true,
"mode": "tour",
"triggers": [
{
"type": "first_visit",
"delay": 1000
}
],
"frequency": {
"type": "once"
},
"tourOptions": {
"steps": [
{
"element": "#step1",
"intro": "Welcome to the Intro.js Campaign System! Let's take a quick tour.",
"title": "Welcome",
"position": "bottom"
},
{
"element": "#step2",
"intro": "This campaign was loaded from a JSON file and triggered automatically on your first visit.",
"title": "Automatic Triggers",
"position": "bottom"
},
{
"element": "#step3",
"intro": "You can configure campaigns with various triggers, targeting rules, and frequencies.",
"title": "Features",
"position": "top"
},
{
"element": ".demo-buttons",
"intro": "Use these buttons to explore different campaign features. That's it! Enjoy the campaign system.",
"title": "Try It Out",
"position": "top"
}
],
"showProgress": true,
"showBullets": true,
"exitOnOverlayClick": false
}
}
]
}
43 changes: 43 additions & 0 deletions example/campaigns/form-assistance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": "1.0.0",
"campaigns": [
{
"id": "form-help-tour",
"name": "Form Assistance Tour",
"description": "Provide help when user starts filling out a form",
"active": true,
"mode": "tour",
"triggers": [
{
"type": "form_interaction",
"selector": "#signup-form input",
"interactionType": "focus"
}
],
"frequency": {
"type": "once"
},
"tourOptions": {
"steps": [
{
"element": "#email-field",
"intro": "Enter your email address. We'll never share it with anyone.",
"position": "right"
},
{
"element": "#password-field",
"intro": "Choose a strong password with at least 8 characters, including numbers and symbols.",
"position": "right"
},
{
"element": "#terms-checkbox",
"intro": "Please review and accept our terms of service and privacy policy.",
"position": "top"
}
],
"exitOnEsc": true,
"showBullets": false
}
}
]
}
49 changes: 49 additions & 0 deletions example/campaigns/idle-user-engagement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"version": "1.0.0",
"campaigns": [
{
"id": "idle-engagement",
"name": "Idle User Engagement",
"description": "Re-engage users who have been idle for a certain period",
"active": true,
"mode": "tour",
"triggers": [
{
"type": "idle_user",
"idleTime": 30000
}
],
"tourOptions": {
"steps": [
{
"intro": "👋 Still here? Let us show you some features you might have missed!",
"title": "Welcome Back!",
"position": "floating"
},
{
"element": "#step1",
"intro": "This is the main content area where you can find important information.",
"title": "Main Content",
"position": "bottom"
},
{
"element": "#step2",
"intro": "Here you'll find additional details and features.",
"title": "More Information",
"position": "bottom"
},
{
"element": ".demo-buttons",
"intro": "Use these buttons to interact with different campaign features and test various triggers.",
"title": "Action Buttons",
"position": "top"
}
],
"showProgress": true,
"showBullets": true,
"exitOnEsc": true,
"exitOnOverlayClick": true
}
}
]
}
Loading
Loading