Add Script
Integrate the Round Two embed script into your application
Add Script
Add the copied embed script to your application's HTML. The script will load asynchronously and handle all embed functionality automatically. The token endpoint is configured server-side in Round Two, so you don't need to specify it in the script.
Implementation
Add the script to your HTML, typically in the <head> section:
<!DOCTYPE html>
<html>
<head>
<!-- Your other head content -->
<script>
(function() {
const script = document.createElement('script');
script.src = 'https://your-roundtwo-domain.com/api/embed/script/YOUR_BOARD_ID';
script.async = true;
script.setAttribute('data-board-id', 'YOUR_BOARD_ID');
document.head.appendChild(script);
})();
</script>
</head>
<body>
<!-- Your application content -->
</body>
</html>
Script Attributes
The embed script is automatically configured based on your Round Two embed settings. The script URL includes all necessary configuration, so you only need to specify:
data-board-id: Your Round Two board ID (required)
All other settings (trigger type, presentation mode, etc.) are configured in Round Two and included automatically in the script.
How It Works
The script will:
- Load asynchronously without blocking page render
- Initialize the embed based on your Round Two configuration
- Handle authentication flow automatically
- Render the feedback form when triggered
For Floating Button:
- Automatically creates and positions the button
- Only appears for authenticated users (floating button requires valid JWT token)
- Handles button clicks to open the form
- Applies your board's brand colors
For Custom Trigger:
- Listens for clicks on elements with your specified data attribute
- Calls your token endpoint when triggered
- Opens the feedback form after authentication
Custom Trigger Example
If you're using a custom trigger, add the data attribute to any element:
<!-- Button trigger -->
<button data-roundtwo-trigger>Submit Feedback</button>
<!-- Link trigger -->
<a href="#" data-roundtwo-trigger>Give Feedback</a>
<!-- Custom element trigger -->
<div class="feedback-widget" data-roundtwo-trigger>
<span>💬 Feedback</span>
</div>
Best Practices:
- Use semantic HTML elements (buttons, links)
- Provide clear visual indication that the element is clickable
- Consider accessibility (keyboard navigation, screen readers)
- Test on different devices and browsers
Next Steps
- Token Endpoint - Create your authentication endpoint
- User Data - Set up username and email in tokens