Add the SDK to your app — one script tag + trigger calls
<!-- Step 1: Add SDK (once, in your <head> or before </body>) -->
<script src="https://usersay.ai/usersay-sdk.js"
data-project="mymap" async></script>
<!-- Step 2: Identify user after login -->
<script>
UserSay.identify({
uid: user.id, // your user's ID
plan: user.plan, // optional: 'free', 'pro', etc.
credits: user.credits // optional: current credit balance
});
</script>
<!-- Step 3: Trigger when the moment is right -->
<script>
// Credits exhausted
if (user.credits <= 0) {
UserSay.trigger('credits_exhausted');
}
// Day 7 of paid plan
if (daysSinceUpgrade(user) === 7) {
UserSay.trigger('day_7_paid');
}
// Visited /pricing
if (location.pathname === '/pricing') {
UserSay.trigger('pricing');
}
// Handle completion (optional)
UserSay.onComplete(function() {
addCredits(user.id, 50);
showToast('Thanks! 50 credits added.');
});
</script>
The SDK handles the modal, iframe, dedup (won't re-show after dismiss/complete), and postMessage. You just call UserSay.trigger() at the right moment.