Widget Visibility Settings
This document explains how to configure the visibility behavior of the InsightEmbed widget on your website.
Visibility Overview
InsightEmbed offers flexible visibility settings that allow you to control when and how the widget appears to your website visitors. You can configure these settings to ensure the widget enhances user experience without being intrusive.
Configuration Methods
You can configure the widget's visibility through:
- Management Portal: Use the visibility settings in the Management Portal
- API: Set visibility properties programmatically via the Widget Configuration API
- Initialization Options: Pass visibility settings when initializing the widget
Basic Visibility Options
Initial State
| Property | Description | Default |
|---|---|---|
initiallyVisible | Whether the widget button is visible when the page loads | true |
initiallyExpanded | Whether the widget panel is expanded when the page loads | false |
Display Delay
| Property | Description | Default |
|---|---|---|
showDelay | Delay in milliseconds before showing the widget after page load | 0 |
expandDelay | Delay in milliseconds before auto-expanding the widget (if enabled) | 0 |
Page-Based Visibility
URL Patterns
You can show or hide the widget based on URL patterns:
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
urlPatterns: {
include: [
'/blog/*',
'/products/*'
],
exclude: [
'/checkout/*',
'/admin/*'
]
}
}
});Query Parameters
You can control visibility based on URL query parameters:
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
queryParams: {
// Show widget only when ?showWidget=true is in the URL
showWidget: 'true',
// Hide widget when ?hideWidget=true is in the URL
hideWidget: 'true'
}
}
});User-Based Visibility
User Segments
You can show the widget only to specific user segments:
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
userSegments: {
// Show to logged-in users only
loggedIn: true,
// Show to users with specific roles
roles: ['premium', 'admin']
}
}
});Visitor History
You can control visibility based on visitor history:
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
visitorHistory: {
// Show only to returning visitors
returningOnly: true,
// Show only after X page views
minPageViews: 3,
// Hide after X uses of the widget
hideAfterUses: 10
}
}
});Behavior-Based Visibility
Scroll Depth
You can show the widget after the user scrolls to a certain depth:
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
scrollTrigger: {
enabled: true,
depth: 50, // Show after scrolling 50% of the page
delay: 500 // Wait 500ms after reaching scroll depth
}
}
});Time on Page
You can show the widget after the user spends a certain amount of time on the page:
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
timeTrigger: {
enabled: true,
seconds: 30 // Show after 30 seconds on the page
}
}
});Exit Intent
You can show the widget when the user shows exit intent (moving cursor toward browser controls):
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
exitIntent: {
enabled: true,
sensitivity: 20, // Higher values = more sensitive detection
delay: 300, // Delay before showing after detecting exit intent
showOnce: true // Only show once per session
}
}
});Responsive Visibility
Device Types
You can control visibility based on device type:
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
devices: {
desktop: true,
tablet: true,
mobile: false // Hide on mobile devices
}
}
});Screen Size
You can control visibility based on screen size breakpoints:
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
breakpoints: {
min: 768, // Hide on screens smaller than 768px
max: 1920 // Hide on screens larger than 1920px
}
}
});Programmatic Control
You can programmatically control the widget's visibility using JavaScript methods:
// Initialize the widget
const widget = InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY'
});
// Show the widget
widget.show();
// Hide the widget
widget.hide();
// Toggle the widget visibility
widget.toggle();
// Expand the widget panel
widget.expand();
// Collapse the widget panel
widget.collapse();Example Configuration
Using the Management Portal
Navigate to Widget Settings > Visibility in the Management Portal to access the visibility settings.
Using JavaScript Initialization
InsightEmbed.init({
apiKey: 'YOUR_WIDGET_API_KEY',
visibility: {
initiallyVisible: true,
showDelay: 2000,
urlPatterns: {
include: ['/blog/*', '/products/*'],
exclude: ['/checkout/*']
},
scrollTrigger: {
enabled: true,
depth: 30
},
devices: {
desktop: true,
tablet: true,
mobile: true
}
}
});Using the API
curl -X PATCH https://api.insightembed.com/v1/widget/configuration \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"visibility": {
"initiallyVisible": true,
"showDelay": 2000,
"urlPatterns": {
"include": ["/blog/*", "/products/*"],
"exclude": ["/checkout/*"]
},
"scrollTrigger": {
"enabled": true,
"depth": 30
},
"devices": {
"desktop": true,
"tablet": true,
"mobile": true
}
}
}'Best Practices
Be Considerate: Avoid showing the widget in ways that might disrupt the user experience
Target Appropriately: Show the widget on pages where content analysis would be most valuable
Respect User Choice: If a user dismisses the widget, respect that choice for a reasonable period
Test Different Strategies: Experiment with different visibility settings to find what works best
Mobile Considerations: Consider using different visibility settings for mobile devices
Common Visibility Scenarios
Blog or Article Pages
Recommended settings: Show after 30% scroll depth or 20 seconds on page
Product Pages
Recommended settings: Initially visible with prominent placement
Documentation Pages
Recommended settings: Initially visible but collapsed, with clear indication of functionality
Landing Pages
Recommended settings: Show only after significant engagement (50% scroll or 45 seconds)