Embedding the Widget
Learn different ways to embed the HelpWidget feedback button on your website or application.
Basic Installation
The simplest way to add HelpWidget is with our script tag:
<script src="https://feedbackview.io/api/widget/YOUR_PROJECT_ID" async> </script>
💡 Where to place it: Add this script tag just before the closing </body> tag for optimal performance.
Advanced Configuration
You can configure the widget by adding data attributes to the script tag:
<script src="https://feedbackview.io/api/widget/YOUR_PROJECT_ID" data-position="bottom-left" data-primary-color="#FF6B6B" data-language="es" data-hide-on-mobile="true" async> </script>
Available Configuration Options
| Attribute | Default | Description |
|---|---|---|
data-position | bottom-right | bottom-right, bottom-left, top-right, top-left |
data-primary-color | #1972f5 | Primary color for buttons and accents |
data-language | auto | Force specific language or use 'auto' for detection |
data-hide-on-mobile | false | Hide widget on mobile devices |
data-button-text | Feedback | Custom text for the widget button |
Dynamic Loading
Load the widget programmatically when needed:
// Load widget on demand
function loadHelpWidget() {
const script = document.createElement('script');
script.src = 'https://feedbackview.io/api/widget/YOUR_PROJECT_ID';
script.async = true;
document.body.appendChild(script);
}
// Load after user action
document.getElementById('load-feedback').addEventListener('click', loadHelpWidget);
// Load after page interaction
setTimeout(loadHelpWidget, 5000); // Load after 5 secondsSingle Page Applications (SPA)
For SPAs, you may need to reinitialize the widget after route changes:
// React Router example
import { useLocation } from 'react-router-dom';
function App() {
const location = useLocation();
useEffect(() => {
if (window.HelpWidget) {
window.HelpWidget.init();
}
}, [location]);
}// Vue Router example
router.afterEach(() => {
if (window.HelpWidget) {
window.HelpWidget.init();
}
});Content Security Policy (CSP)
If your site uses CSP headers, add these directives:
Content-Security-Policy: script-src 'self' https://feedbackview.io; frame-src 'self' https://feedbackview.io; connect-src 'self' https://api.feedbackview.io; img-src 'self' https://feedbackview.io data:;
Common Platforms
WordPress
Add the script to your theme's footer.php file or use a plugin like "Insert Headers and Footers".
Location: wp-content/themes/your-theme/footer.php
Shopify
Add the script to your theme's theme.liquid file before the closing </body> tag.
Location: Online Store > Themes > Actions > Edit Code
Squarespace
Add via Settings > Advanced > Code Injection in the Footer section.
Requires Business plan or higher.
Troubleshooting
Widget not showing?
- Verify your project ID is correct
- Check browser console for JavaScript errors
- Ensure the script is loaded after DOM is ready
Styling conflicts?
- The widget uses isolated styles with high specificity
- CSS conflicts are rare but can be resolved with custom CSS
Performance concerns?
- Script loads asynchronously and is under 15KB gzipped
- Widget only loads when user interacts with button
- No impact on page load speed or SEO