Your First Rating
Complete walkthrough from zero to first rating in 15 minutes
This guide walks you through everythingβfrom signing up to seeing your first rating in the dashboard. Perfect for first-time users.
Time to complete: ~15 minutes
Prerequisites
Before we start, you'll need:
- A web app or website (even a local HTML file works!)
- A TheWebRatings account - Sign up FREE (takes 2 minutes)
- Your API key - Get it from your dashboard
Step 1: Get Your API Key
- Go to thewebratings.com/dashboard
- Enter your email and verify with the OTP sent to your inbox
- Complete onboarding (profile setup + add your app)
- Navigate to Dashboard β Settings β API Keys
- Generate and copy your API key
Keep this key safe! API keys are shown only once. It connects the widget to your account. Don't commit it to public repos.
Step 2: Create Your Test HTML File
Create a new file called test-feedback.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Rating - TheWebRatings</title>
<!-- Load TheWebRatings widget -->
<script src="https://cdn.thewebratings.com/twr.min.js"></script>
<style>
body {
font-family: system-ui, -apple-system, sans-serif;
max-width: 600px;
margin: 50px auto;
padding: 20px;
}
button {
background: #3b82f6;
color: white;
border: none;
padding: 12px 24px;
font-size: 16px;
border-radius: 8px;
cursor: pointer;
}
button:hover {
background: #2563eb;
}
</style>
</head>
<body>
<h1>π Welcome to My App</h1>
<p>Try leaving a review using the button below:</p>
<button onclick="openFeedback()">Leave a Review</button>
<script>
// Step 1: Initialize the widget with your API key (failsafe)
(function () {
if (!window.TheWebRatings || typeof TheWebRatings.init !== 'function') {
console.error('TheWebRatings script not loaded. Check the <script src=\"https://cdn.thewebratings.com/twr.min.js\"> tag.');
return;
}
TheWebRatings.init({
apiKey: 'your-api-key-here', // β Replace with your actual API key
debug: true // Shows helpful logs in console
});
})();
// Step 2: Function to open the review widget
function openFeedback() {
// Replace with your email for testing
const testEmail = '[email protected]';
const testName = 'Test User';
TheWebRatings.open(testEmail, testName);
}
</script>
</body>
</html>Replace these values:
your-api-key-hereβ Your actual API key from the dashboard[email protected]β Your real email (you'll receive an OTP)
Step 3: Open Your Test File
- Save the file
- Open it in your browser (double-click or drag to browser)
- Open the browser console (F12 or Right-click β Inspect β Console)
You should see:
β TheWebRatings initialized successfullyIf you see errors instead, jump to Troubleshooting below.
Step 4: Submit Your First Rating
-
Click the "Leave a Review" button β The review widget slides up from the bottom of the screen
-
Select a star rating (e.g., 5 stars βββββ) β Automatically advances to the review text step
-
Optionally add a written review (e.g., "This is amazing!") β Minimum 20 characters required to enable the submit button
-
Click "Submit Review"
-
Check your email for the OTP (one-time password)
- Subject: "Your verification code for TheWebRatings"
- Code looks like:
123456
-
Enter the OTP in the widget β Your rating is now submitted!
-
Success screen shown inside the widget β Click "Done" to close. π
Step 5: Verify in Dashboard
- Go to your TheWebRatings dashboard
- Navigate to Ratings or Reviews
- You should see your rating! with:
- Star rating (5 stars)
- Written review ("This is amazing!")
- Timestamp (just now)
- User email (your test email)
If you see it β Congratulations! You're all set up! π
What Just Happened? (Behind the Scenes)
Here's the flow that occurred:
1. User clicks button
β
2. open() called with email & name
β
3. Bottom sheet slides up β checks for existing review
β
4. No existing review β Star rating step shown
β
5. User picks stars β Review text step shown
β
6. User submits β Widget checks if user exists in TWR database
β
7. User doesn't exist β Widget creates new user & sends OTP
β
8. User enters OTP β Widget verifies it
β
9. User is authenticated β Rating is submitted
β
10. Inline success screen shown β Rating appears in your dashboardThe next time this user submits a new rating, OTP is skippedβthe widget remembers them via localStorage. However, editing or deleting an existing review will still require OTP verification.
Listen to Submission Events (Optional)
Want to do something when a rating is submitted? Add event listeners:
<script>
(function () {
if (!window.TheWebRatings || typeof TheWebRatings.init !== 'function') {
console.error('TheWebRatings script not loaded. Check the <script src=\"https://cdn.thewebratings.com/twr.min.js\"> tag.');
return;
}
TheWebRatings.init({
apiKey: 'your-api-key-here',
debug: true
});
// Listen for successful submission
TheWebRatings.on('rating:submitted', (data) => {
console.log('Rating submitted!', data.ratingId, data.rating);
// Example: Show a thank you message
alert(`Thank you for your ${data.rating}-star rating!`);
});
})();
function openFeedback() {
TheWebRatings.open('[email protected]', 'Test User');
}
</script>Learn more: Event Handlers Guide
Integrate with Your Real App
Now that you've tested it, integrate it into your actual app.
Initialize only for logged-in users
Do not add the widget to your public pages or root layout. Initialize it in your authenticated area (dashboard, member portal, admin panel) β this ensures the auto-prompt only fires for logged-in users.
For Static Sites
Add the script and initialization to your authenticated pages (e.g., dashboard), and replace the hardcoded email/name with dynamic values:
function openFeedback() {
// Get currently logged-in user from your app
const user = getCurrentUser(); // Your function
TheWebRatings.open(user.email, user.name);
}For React Apps
Initialize in a component that only renders for authenticated users (e.g., a dashboard layout):
import { useEffect } from 'react';
function Dashboard() {
const user = useAuth(); // Your auth hook
useEffect(() => {
TheWebRatings.init({
apiKey: process.env.REACT_APP_TWR_API_KEY,
debug: false
});
}, []);
const handleFeedback = () => {
TheWebRatings.open(user.email, user.name);
};
return (
<button onClick={handleFeedback}>
Leave a Review
</button>
);
}More framework examples: React, Vue, Angular
Troubleshooting
Widget doesn't load / TheWebRatings is undefined
Possible causes:
- Script tag is in wrong location
- Network error blocking CDN
- Ad blocker blocking script
Fix:
- Check browser console for errors
- Try disabling ad blockers
- Verify the script URL is correct (e.g.
https://cdn.thewebratings.com/twr.min.jsor your CDN) - Make sure script loads before you call
init()
"Invalid API key" error
Fix:
- Double-check your API key in the dashboard under Settings β API Keys
- Make sure there are no extra spaces or quotes
- Regenerate the key if you've lost it (keys are shown only once)
Widget doesn't slide up when button is clicked
Possible causes:
init()wasn't called- JavaScript error preventing execution
- Email/name parameters missing
Fix:
- Open browser console and check for errors
- Verify
TheWebRatings.init()was called - Ensure
open(email, name)has both parameters
OTP email not received
Possible causes:
- Email in spam folder
- Typo in email address
- Email server delay
Fix:
- Check spam/junk folder
- Verify email address is correct (no typos)
- Wait 60 secondsβwidget will show "Resend OTP" option
- Try with a different email (Gmail, Outlook, etc.)
Rating doesn't appear in dashboard
Possible causes:
- OTP was not verified
- Network error during submission
Fix:
- Confirm you completed the OTP verification step
- Check browser console for
rating:submittedevent - Try refreshing the dashboard
Widget appears but submission fails
Check the browser console for errors. The widget does not emit a separate error event; on network failure it stores the review locally and shows the success screen. Use rating:submitted to confirm when a rating was successfully sent to the server.
Common error types:
network- Check internet connectionauthentication- OTP not verified or expiredvalidation- Missing required fieldsrate_limit- Too many submissions (wait 60 seconds)server- Backend issue (rare, contact support)
Next Steps
π Congrats on your first rating! Now explore:
- Configuration Options - Customize colors, labels, button text
- Event Handlers - React to submissions, grant rewards, track analytics
- Framework Guides - React, Vue, Angular, Next.js integration patterns
- Examples - Copy-paste code snippets
Need Help?
- Email: [email protected]
We typically respond within 24 hours. Happy rating!