earningbirds
v1.0.1
Published
Earningbirds web plugin for user research
Downloads
78
Readme
Earningbirds
Earningbirds is a web plugin for embedding user research widgets into your website.
Installation
npm
npm install earningbirdsyarn
yarn add earningbirdsUsage
ES Module
import Earningbirds from 'earningbirds';
Earningbirds.init({
project: 'YOUR_PROJECT_ID'
});CommonJS
const Earningbirds = require('earningbirds');
Earningbirds.init({
project: 'YOUR_PROJECT_ID'
});Script Tag
You can also use Earningbirds without npm by adding a script tag directly:
<script>
(function () {
var w = window;
if (!w.Earningbirds) { w.Earningbirds = {}; }
w.Earningbirds.project = "YOUR_PROJECT_ID";
function l() {
if (w.EarningbirdsInitialized) { return; }
w.EarningbirdsInitialized = true;
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src = "https://app.earningbirds.com/plugin/1.0.1/eb-plugin-web.js";
var x = document.getElementsByTagName("head")[0];
if (x) { x.appendChild(s); }
}
if (document.readyState === "complete") { l(); }
else { w.addEventListener("DOMContentLoaded", l); w.addEventListener("load", l); }
})();
</script>Framework Examples
React
import { useEffect } from 'react';
import Earningbirds from 'earningbirds';
function App() {
useEffect(() => {
Earningbirds.init({ project: 'YOUR_PROJECT_ID' });
}, []);
return <div>My App</div>;
}Next.js
'use client';
import { useEffect } from 'react';
import Earningbirds from 'earningbirds';
export default function EarningbirdsProvider({ children }) {
useEffect(() => {
Earningbirds.init({ project: 'YOUR_PROJECT_ID' });
}, []);
return <>{children}</>;
}Vue
<script setup>
import { onMounted } from 'vue';
import Earningbirds from 'earningbirds';
onMounted(() => {
Earningbirds.init({ project: 'YOUR_PROJECT_ID' });
});
</script>API
Earningbirds.init(options)
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| project | string | Yes | Your Earningbirds project ID |
License
MIT
