Complete guide for integrating the TestiFlow testimonial widget into your website
Add this single line before </body> in your HTML:
<script
src="https://testiflow.site/script.js"
data-site-id="your-site-id-here">
</script>What you get:
Complete working example with button and testimonials display:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Website</title>
<!-- CSP: Add this if your site uses Content Security Policy -->
<meta http-equiv="Content-Security-Policy"
content="script-src 'self' 'unsafe-inline' https://testiflow.site;
connect-src 'self' https://testiflow.site;">
<style>
body {
font-family: Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
#testimonials-container {
margin: 40px 0;
}
</style>
</head>
<body>
<h1>Welcome to Our Website</h1>
<!-- Testimonials will display here -->
<h2>What Our Customers Say</h2>
<div id="testimonials-container"></div>
<!-- Load Testimonial Script -->
<script
src="https://testiflow.site/script.js"
data-site-id="your-site-id-here">
</script>
<!-- Display Testimonials -->
<script>
let widgetInstance = null;
let isDisplaying = false;
async function displayTestimonials() {
if (isDisplaying) return;
isDisplaying = true;
try {
await new Promise(resolve => setTimeout(resolve, 2000));
if (!window.TestimonialWidget) {
setTimeout(displayTestimonials, 2000);
isDisplaying = false;
return;
}
const container = document.getElementById('testimonials-container');
if (container) container.innerHTML = '';
if (!widgetInstance) {
widgetInstance = new window.TestimonialWidget(
'your-site-id-here',
'https://testiflow.site'
);
}
await widgetInstance.displayTestimonials('testimonials-container', {
layout: 'grid', // 'grid', 'list', or 'carousel'
limit: 6, // Number to show
showRating: true, // Show ratings
showAuthor: true // Show author info
});
} catch (error) {
console.error('Error displaying testimonials:', error);
} finally {
isDisplaying = false;
}
}
window.addEventListener('load', displayTestimonials, { once: true });
</script>
</body>
</html>If you only want the submission button (no display):
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Website</title>
<!-- CSP: Only if your site uses CSP -->
<meta http-equiv="Content-Security-Policy"
content="script-src 'self' 'unsafe-inline' https://testiflow.site;
connect-src 'self' https://testiflow.site;">
</head>
<body>
<h1>Welcome</h1>
<p>Click the button to leave a testimonial!</p>
<!-- Just add the script tag - button appears automatically -->
<script
src="https://testiflow.site/script.js"
data-site-id="your-site-id-here">
</script>
</body>
</html>await widgetInstance.displayTestimonials('container-id', {
layout: 'grid',
limit: 6,
showRating: true,
showAuthor: true
});await widgetInstance.displayTestimonials('container-id', {
layout: 'list',
limit: 10,
showRating: true,
showAuthor: true
});await widgetInstance.displayTestimonials('container-id', {
layout: 'carousel',
limit: 5,
showRating: true,
showAuthor: true
});All customization is done in your Dashboard, not in code:
Visit your dashboard to customize!
If you see "blocked:csp" error, add this meta tag to your <head>:
<meta http-equiv="Content-Security-Policy"
content="script-src 'self' 'unsafe-inline' https://testiflow.site;
connect-src 'self' https://testiflow.site;">Make sure to:
container.innerHTML = '';isDisplaying flag to prevent multiple calls{ once: true } on event listeners