diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index 21abbc7..2bc71f4 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -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() { Keep them forever → )} + {/* 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 && ( +
+
+ Publish these clips straight from here.{' '} + Connect your YouTube, TikTok or Instagram once — after that every clip is one click from posted. +
+ + +
+ )} {/* Self-host only: cloud archives clips to the video library, here they really are gone once the retention sweep runs. */} {!billingEnabled && jobRetentionSeconds > 0 && ( diff --git a/dashboard/src/lib/analytics.js b/dashboard/src/lib/analytics.js index 081ef14..1f5fac6 100644 --- a/dashboard/src/lib/analytics.js +++ b/dashboard/src/lib/analytics.js @@ -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.