Code Examples
Copy-paste ready code for common integrations
Quick Examples
Ready-to-use code snippets for integrating TheWebRatings widget into your app.
Examples by Framework
- Vanilla JavaScript - Plain HTML/JS (no framework)
- React / Next.js - React hooks and components
For more frameworks (Vue, Angular, Svelte, Astro, etc.), see the Framework Guides.
Basic Example
The simplest possible integration:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.thewebratings.com/twr.min.js"></script>
</head>
<body>
<button onclick="TheWebRatings.open('[email protected]', 'User Name')">
Rate Us
</button>
</body>
</html>That's it! Replace the email/name with your logged-in user's data.
Next Steps
Pick the example that matches your tech stack and copy-paste the code. All examples are production-ready and follow best practices.