Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Multicorn API (for newsletter signup and other client-side API calls)
# Default: https://api.multicorn.ai. Use http://localhost:8080 for local dev.
NEXT_PUBLIC_API_URL=https://api.multicorn.ai

# Plausible Analytics (privacy-friendly analytics)
NEXT_PUBLIC_PLAUSIBLE_DOMAIN=multicorn.ai
1 change: 1 addition & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
<PwaMetaTags />
<ServiceWorkerRegistrar />
<LaunchGate>{children}</LaunchGate>
{/* Domain is encoded in the proxy script URL - no data-domain attribute needed */}
{process.env.NODE_ENV === 'production' && (
<>
<Script
Expand Down
4 changes: 2 additions & 2 deletions app/shield/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export default function ShieldPage() {
<TrackedCtaLink
href="https://app.multicorn.ai/signup"
className="inline-flex min-h-[44px] items-center rounded-lg bg-primary px-8 py-3 text-base font-semibold text-white shadow-sm transition-colors hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-primary/20 focus:ring-offset-2"
eventName="signup_cta_click"
eventName="shield_signup_click"
eventProps={{ location: 'shield_hero' }}
>
Start for free
Expand Down Expand Up @@ -800,7 +800,7 @@ export default function ShieldPage() {
<TrackedCtaLink
href="https://app.multicorn.ai/signup"
className="inline-flex min-h-[44px] items-center rounded-lg bg-primary px-8 py-3 text-base font-semibold text-white shadow-sm transition-colors hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-primary/20 focus:ring-offset-2"
eventName="signup_cta_click"
eventName="shield_signup_click"
eventProps={{ location: 'shield_bottom_cta' }}
>
Start for free
Expand Down
12 changes: 11 additions & 1 deletion components/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
'use client'

import { useState } from 'react'
import { trackEvent } from '@/lib/plausible'

interface AnalyticsEvent {
readonly event: string
readonly props?: Record<string, string>
}

interface CopyButtonProps {
readonly text: string
readonly label?: string
readonly analyticsEvent?: AnalyticsEvent
}

export function CopyButton({ text, label = 'Copy to clipboard' }: CopyButtonProps) {
export function CopyButton({ text, label = 'Copy to clipboard', analyticsEvent }: CopyButtonProps) {
const [copied, setCopied] = useState(false)

async function handleCopy() {
try {
await navigator.clipboard.writeText(text)
setCopied(true)
if (analyticsEvent) {
trackEvent(analyticsEvent.event, analyticsEvent.props)
}
setTimeout(() => setCopied(false), 2000)
} catch {
setCopied(false)
Expand Down
2 changes: 1 addition & 1 deletion components/EmailSignupForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function EmailSignupForm({ source: sourceProp }: EmailSignupFormProps = {
}

setFormState(FORM_STATES.success)
trackEvent('email_signup')
trackEvent('newsletter_signup')
} catch {
setFormState(FORM_STATES.error)
setSubmitError('Something went wrong. Please try again.')
Expand Down
5 changes: 4 additions & 1 deletion lib/mdx-blog-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export const blogComponents = {
<div className="mb-6 overflow-hidden rounded-lg border border-border bg-text-primary">
<div className="flex items-center justify-between border-b border-white/10 px-4 py-2">
<span className="text-xs text-text-tertiary">{language || 'code'}</span>
<CopyButton text={codeText} />
<CopyButton
text={codeText}
analyticsEvent={{ event: 'prompt_copied', props: { category: 'code_block' } }}
/>
</div>
<pre className="overflow-x-auto px-4 py-3">
<code className="text-sm text-green">{codeText}</code>
Expand Down
Loading