Skip to main content

Overview

Load feedbackfun directly from our CDN using a <script> tag. The widget auto-initializes when the page loads — no JavaScript code required.

Installation

Add both lines before the closing </body> tag:
<link rel="stylesheet" href="https://cdn.feedbackfun.com/feedbackfun-widget.min.css">
<script
  src="https://cdn.feedbackfun.com/feedbackfun-widget.min.js"
  data-feedbackfun-api-key="YOUR_API_KEY"
  data-feedbackfun-project-id="YOUR_PROJECT_ID">
</script>

Data attributes

Configure the widget using data-* attributes on the <script> tag:
AttributeRequiredDescription
data-feedbackfun-api-keyYesYour project API key from the dashboard
data-feedbackfun-project-idYesYour numeric project ID
data-feedbackfun-dev-domainNoYour production domain — use during local dev to bypass domain validation
data-feedbackfun-api-urlNoCustom API URL (default: https://feedbackfun.com)

Local development

When running on localhost, pass your production domain via data-feedbackfun-dev-domain:
<script
  src="https://cdn.feedbackfun.com/feedbackfun-widget.min.js"
  data-feedbackfun-api-key="YOUR_API_KEY"
  data-feedbackfun-project-id="YOUR_PROJECT_ID"
  data-feedbackfun-dev-domain="yoursite.com">
</script>
Remove data-feedbackfun-dev-domain before deploying to production.

Full HTML example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>My App</title>
</head>
<body>
  <!-- Your page content -->

  <link rel="stylesheet" href="https://cdn.feedbackfun.com/feedbackfun-widget.min.css">
  <script
    src="https://cdn.feedbackfun.com/feedbackfun-widget.min.js"
    data-feedbackfun-api-key="YOUR_API_KEY"
    data-feedbackfun-project-id="YOUR_PROJECT_ID">
  </script>
</body>
</html>

Runtime API

After the widget loads, you can call these methods from JavaScript:
// Change primary color at runtime
window.feedbackfun.setPrimaryColor('#6366f1');

// Change primary foreground color
window.feedbackfun.setPrimaryForeground('#ffffff');

// Identify the logged-in user
window.feedbackfun.setUserInfo({
  id: 'user_123',
  email: 'user@example.com',
  name: 'Jane Doe'
});

// Clear user info on logout
window.feedbackfun.clearUserInfo();
window.feedbackfun is available after the script tag loads. Wrap calls in a DOMContentLoaded listener if you call them before the page fully loads.