How to integrate ?
There are two ways to integrate user feedback into your website or app.
- Either embed our simple small script
- Or Use our simple and easy feedback rest api
Script
1. Simple HTML
<script defer src="https://scripts.easystartup.io/js/feedback.js" data-id="IdPresentInYourSettingsPageOfFeedback"/>
To open the feedback modal use this snippet in your Feedback button
window.easyStartupFeedback().open();
Sample example
<script defer src="https://scripts.easystartup.io/js/feedback.js" data-id="IdPresentInYourSettingsPageOfFeedback"
uniqueUserId="awesomeness@easystartup.io"/>
<div onclick="window.easyStartupFeedback().open()">
Feedback Button
</div>
Params
- pageIdentifier -> Default value is window.location.pathname . You can harcode it in the script or you can set
using sdk.
window.easyStartupFeedback().setPageIdentifier();
- uniqueUserId -> You can either hard code it in the script or you can set it using the
sdk
window.easyStartupFeedback().setUniqueUserId(userId);
danger
Make sure that you set these params after the script is loaded. By using the onload
attribute. Sample example
<script defer src="https://scripts.easystartup.io/js/feedback.js" data-id="636765ab57f06a2aa507e28b" onload="function (){
window.easyStartupFeedback().setUniqueUserId(" awesome@easystartup.io");
window.easyStartupFeedback().setPageIdentifier("Home");
}" />
2. NextJS
Add it to _app.js or if you have a header in your header.tsx / header.jsx file
- Add Script
- Set data-id attribute in Script
- Set a state variable that script has been loaded
- Using useEffect when your script gets loaded or if and user is logged id set a uniqueUserId
import { useEffect, useState } from "react";
import Script from "next/script";
export default function Header({userId}) {
const [feedbackScriptLoaded, setFeedbackScriptLoaded] = useState(false);
useEffect(() => {
if (!userId || !feedbackScriptLoaded){
return;
}
try {
window.easyStartupFeedback().setUniqueUserId(userId);
} catch (err) {
console.log(err);
}
}, [feedbackScriptLoaded, userId]);
return (<div>
<Script
src="https://scripts.easystartup.io/js/feedback.js"
data-id="636765aa57f06a2aa507e28c"
onLoad={() => {
setFeedbackScriptLoaded(true);
}}
/>
<div onClick={()=>{
if (window.easyStartupFeedback ) {
window.easyStartupFeedback().open()
}
}}>
Give Feedback
</div>
</div>)
}
API
Use simple REST API to send feedback if you do not want to expose the data-id in the public