feat(dashboard): social-connect nudge at the results peak

Only 2.7% of cloud users who pass through the social flow ever connect a
network (146 of 5,406 Upload-Post profiles), yet publishing from the app
is the strongest retention loop we have. Show a dismissible banner right
when the clips appear - the moment with the best odds - prompting managed
users with no connected network to open the hosted connect page.

Instrumented like the other conversion moments: SocialNudgeSeen (once per
job), SocialNudgeConnect, SocialNudgeDismissed (persisted in localStorage,
never shown again). Hidden automatically once any network is linked.
This commit is contained in:
juancarlos.cavero 2026-08-21 04:36:05 +02:00
parent 9d18520c2e
commit 0b59047422
2 changed files with 54 additions and 0 deletions

View file

@ -24,6 +24,7 @@ import ProfileMenu from './components/ProfileMenu';
import Modal from './components/ui/Modal';
import { useAuth } from './contexts/AuthContext';
import { apiFetch, apiJson, QuotaError } from './lib/api';
import { track } from './lib/analytics';
// Enhanced "Encryption" using XOR + Base64 with a Salt
// This is better than plain Base64 but still client-side.
@ -215,6 +216,13 @@ function App() {
const [uploadUserId, setUploadUserId] = useState(() => localStorage.getItem('uploadUserId') || '');
const [userProfiles, setUserProfiles] = useState([]); // List of {username, connected: []}
// Post-generation social nudge: shown at the results peak until the user
// either connects a network or dismisses it. Only 2.7% of cloud users who
// reach the social flow ever connect an account — this is the moment (clips
// just appeared) with the best odds of moving that number.
const [socialNudgeDismissed, setSocialNudgeDismissed] = useState(() => {
try { return localStorage.getItem('os_social_nudge_dismissed') === '1'; } catch (_) { return false; }
});
const [showKeyModal, setShowKeyModal] = useState(false);
const [jobId, setJobId] = useState(null);
const [status, setStatus] = useState('idle'); // idle, processing, complete, error
@ -612,6 +620,21 @@ function App() {
const gateThisTab = needsPlan && INCLUDED_TOOL_TABS.includes(activeTab); // included tool, no plan yet
const advancedThisTab = billingEnabled && ADVANCED_TOOL_TABS.includes(activeTab); // BYOK-notice tools
// Social nudge visibility: managed users with clips on screen and no network
// connected yet. userProfiles being empty (not yet fetched / none created)
// also counts as "not connected" — that is the 97% case.
const connectedSocials = ((userProfiles.find((p) => p.username === uploadUserId) || userProfiles[0])?.connected) || [];
const showSocialNudge = isManaged && !socialNudgeDismissed && connectedSocials.length === 0;
// One Seen event per job, only when the banner actually rendered.
const socialNudgeSeenRef = useRef(null);
useEffect(() => {
if (status === 'complete' && (results?.clips?.length > 0) && showSocialNudge && socialNudgeSeenRef.current !== jobId) {
socialNudgeSeenRef.current = jobId;
track('SocialNudgeSeen', { props: { clips: results.clips.length } });
}
}, [status, results, showSocialNudge, jobId]);
// Managed users connect their socials via Upload-Post's branded hosted page.
const handleConnectSocials = async () => {
try {
@ -1485,6 +1508,34 @@ function App() {
<span className="text-brass font-medium">Keep them forever →</span>
</button>
)}
{/* Distribution nudge at the same peak: clips on screen,
publishing them is one connect away. Hidden once any
network is linked or the user dismisses it. */}
{showSocialNudge && (
<div className="w-full flex items-center gap-3 px-3 py-2.5 rounded-input bg-paper3 border border-rule text-sm">
<div className="flex-1 min-w-0">
<span className="text-ink">Publish these clips straight from here.</span>{' '}
<span className="text-muted">Connect your YouTube, TikTok or Instagram once — after that every clip is one click from posted.</span>
</div>
<button
onClick={() => { track('SocialNudgeConnect'); handleConnectSocials(); }}
className="btn-quiet shrink-0 text-xs py-1.5 px-3 lowercase"
>
connect socials →
</button>
<button
onClick={() => {
track('SocialNudgeDismissed');
setSocialNudgeDismissed(true);
try { localStorage.setItem('os_social_nudge_dismissed', '1'); } catch (_) { /* ignore */ }
}}
aria-label="dismiss"
className="shrink-0 p-1 text-muted hover:text-ink"
>
<X size={14} />
</button>
</div>
)}
{/* Self-host only: cloud archives clips to the video library,
here they really are gone once the retention sweep runs. */}
{!billingEnabled && jobRetentionSeconds > 0 && (

View file

@ -16,6 +16,9 @@
// - CheckoutRedirected — Stripe returned a URL and we are sending them there
// - CheckoutFailed — /api/billing/checkout errored, `reason` says why
// - Subscribed — plan activated after checkout
// - SocialNudgeSeen — post-generation "connect socials" banner rendered
// - SocialNudgeConnect — its connect button clicked (opens hosted connect page)
// - SocialNudgeDismissed — its X clicked (persisted, never shown again)
// The Started → Redirected → Subscribed chain is what separates "never reached
// Stripe" from "reached Stripe and abandoned"; before 2-ago-2026 the modals
// emitted only their own *Checkout event and the difference was invisible.