🐣 Nudgie Widget Integration

Collect user feedback in under 2 minutes. No build step required.

Quick Start

Add this single script tag before the closing </body> tag on any page:

HTML
<script
  src="https://your-nudgie-url.com/widget.js"
  data-ff-key="YOUR_API_KEY"
  defer
></script>

Replace YOUR_API_KEY with your project API key from the dashboard.

Customization

Use data- attributes to customize the widget:

AttributeDefaultDescription
data-ff-keyYour project API key (required)
data-ff-color#4f46e5Primary brand color (hex)
data-ff-text-color#ffffffButton text color (hex)
data-ff-positionbottom-rightWidget position: bottom-right or bottom-left
Example: Custom colors & position
<script
  src="https://your-nudgie-url.com/widget.js"
  data-ff-key="ff_abc123..."
  data-ff-color="#10b981"
  data-ff-text-color="#ffffff"
  data-ff-position="bottom-left"
  defer
></script>

Framework Examples

Next.js (App Router)

app/layout.tsx
import Script from "next/script";

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          src="https://your-nudgie-url.com/widget.js"
          data-ff-key="YOUR_API_KEY"
          strategy="lazyOnload"
        />
      </body>
    </html>
  );
}

React (Vite / CRA)

src/App.tsx
import { useEffect } from "react";

function App() {
  useEffect(() => {
    const script = document.createElement("script");
    script.src = "https://your-nudgie-url.com/widget.js";
    script.setAttribute("data-ff-key", "YOUR_API_KEY");
    script.defer = true;
    document.body.appendChild(script);
    return () => { document.body.removeChild(script); };
  }, []);

  return <div>Your App</div>;
}

Vue.js

App.vue
<script setup>
import { onMounted } from "vue";

onMounted(() => {
  const script = document.createElement("script");
  script.src = "https://your-nudgie-url.com/widget.js";
  script.setAttribute("data-ff-key", "YOUR_API_KEY");
  script.defer = true;
  document.body.appendChild(script);
});
</script>

Plain HTML

index.html
<!DOCTYPE html>
<html>
<head><title>My Site</title></head>
<body>
  <h1>Welcome</h1>
  <script
    src="https://your-nudgie-url.com/widget.js"
    data-ff-key="YOUR_API_KEY"
    defer
  ></script>
</body>
</html>

REST API Reference

You can also submit feedback programmatically:

POST /api/feedback
curl -X POST https://your-nudgie-url.com/api/feedback \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "ff_abc123...",
    "message": "Love this feature!",
    "rating": 5,
    "email": "user@example.com",
    "pageUrl": "https://mysite.com/pricing"
  }'

Request Body

  • apiKey (required) — Project API key
  • message (required) — Feedback text (max 1000 chars)
  • rating — 1-5 integer
  • email — User email
  • pageUrl — Page where feedback was submitted

Response

{ "success": true, "id": "60f7b2..." }

Domain Restriction

Set allowed domains in your project settings to restrict which websites can submit feedback. Supports comma-separated domains and subdomain matching. Leave empty to allow all origins.

Rate Limiting

The feedback API is rate-limited to 10 requests per minute per IP address. The X-RateLimit-Remaining header indicates remaining requests.