Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
}
}
]
}
48 changes: 48 additions & 0 deletions example/campaigns/first-visit-tour.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"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": "#header",
"intro": "Welcome to our application! Let's take a quick tour.",
"position": "bottom"
},
{
"element": "#navigation",
"intro": "This is the main navigation menu. You can access all features from here.",
"position": "right"
},
{
"element": "#content",
"intro": "Your main content will appear here.",
"position": "top"
},
{
"element": "#footer",
"intro": "That's it! Enjoy using our application.",
"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
}
}
]
}
41 changes: 41 additions & 0 deletions example/campaigns/idle-user-engagement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"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
}
],
"frequency": {
"type": "session"
},
"tourOptions": {
"steps": [
{
"intro": "Still here? Let us show you some features you might have missed!",
"position": "floating"
},
{
"element": ".shortcuts-panel",
"intro": "Did you know you can use keyboard shortcuts? Press '?' to see all available shortcuts.",
"position": "right"
},
{
"element": ".recent-items",
"intro": "Your recently accessed items are always available here for quick access.",
"position": "left"
}
],
"exitOnEsc": true,
"exitOnOverlayClick": true
}
}
]
}
50 changes: 50 additions & 0 deletions example/campaigns/returning-user-features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"version": "1.0.0",
"campaigns": [
{
"id": "returning-user-advanced",
"name": "Advanced Features for Returning Users",
"description": "Show advanced features to users who have visited before",
"active": true,
"mode": "tour",
"triggers": [
{
"type": "returning_user",
"minVisits": 2,
"delay": 2000
}
],
"frequency": {
"type": "once"
},
"tourOptions": {
"steps": [
{
"intro": "Welcome back! We noticed you've been here before. Let us show you some advanced features!",
"position": "floating"
},
{
"element": ".keyboard-shortcuts",
"intro": "Press 'Ctrl+K' to access the command palette for quick navigation.",
"position": "bottom"
},
{
"element": ".advanced-filters",
"intro": "Use advanced filters to find exactly what you need quickly.",
"position": "left"
},
{
"element": ".bulk-actions",
"intro": "Select multiple items and perform bulk actions to save time.",
"position": "top"
}
],
"showProgress": true
},
"analytics": {
"trackViews": true,
"trackCompletions": true
}
}
]
}
40 changes: 40 additions & 0 deletions example/campaigns/scroll-depth-newsletter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"version": "1.0.0",
"campaigns": [
{
"id": "newsletter-signup-50",
"name": "Newsletter Signup at 50% Scroll",
"description": "Prompt newsletter signup when user scrolls 50% down the page",
"active": true,
"mode": "tour",
"triggers": [
{
"type": "scroll_depth",
"percentage": 50
}
],
"frequency": {
"type": "once"
},
"tourOptions": {
"steps": [
{
"intro": "<h3>Enjoying our content?</h3><p>Subscribe to our newsletter for weekly updates and exclusive content!</p>",
"position": "floating"
},
{
"element": "#newsletter-form",
"intro": "Enter your email here to stay updated with our latest articles and news.",
"position": "top"
}
],
"exitOnEsc": true,
"exitOnOverlayClick": true
},
"analytics": {
"trackViews": true,
"trackCompletions": true
}
}
]
}
47 changes: 47 additions & 0 deletions example/campaigns/scroll-triggered-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "1.0.0",
"campaigns": [
{
"id": "pricing-tour",
"name": "Pricing Section Tour",
"description": "Tour that triggers when user scrolls to pricing section",
"active": true,
"mode": "tour",
"triggers": [
{
"type": "scroll_to_element",
"selector": "#pricing-section",
"threshold": 0.6
}
],
"frequency": {
"type": "session"
},
"tourOptions": {
"steps": [
{
"element": ".pricing-card-basic",
"intro": "Our Basic plan is perfect for individuals just getting started.",
"position": "top"
},
{
"element": ".pricing-card-pro",
"intro": "The Pro plan includes all features plus priority support.",
"position": "top"
},
{
"element": ".pricing-card-enterprise",
"intro": "Enterprise plan offers custom solutions for large teams.",
"position": "top"
},
{
"element": ".pricing-comparison",
"intro": "Compare all plans side-by-side to find the perfect fit.",
"position": "bottom"
}
],
"showBullets": true
}
}
]
}
39 changes: 39 additions & 0 deletions src/packages/campaign/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Intro.js Campaign System
*
* A no-code campaign management system for Intro.js that allows you to create
* and manage guided tours and hints using JSON configuration files.
*
* @example
* ```typescript
* import { initializeCampaigns } from 'intro.js/campaign';
*
* // Load campaigns from JSON file
* await initializeCampaigns('/campaigns.json');
*
* // Or load campaigns from object
* await initializeCampaigns({
* version: '1.0.0',
* campaigns: [
* {
* id: 'welcome-tour',
* name: 'Welcome Tour',
* active: true,
* mode: 'tour',
* triggers: [{ type: 'first_visit' }],
* tourOptions: {
* steps: [
* { element: '#step1', intro: 'Welcome!' }
* ]
* }
* }
* ]
* });
* ```
*/

export * from "./types";
export { CampaignManager, getCampaignManager, initializeCampaigns } from "./manager";
export { TriggerDetector } from "./triggers";
export { UserTracker } from "./userTracker";
export { CampaignStorage } from "./storage";
Loading
Loading