mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge pull request #1687 from appwrite/feat-onboarding-analytics
Feat onboarding analytics
This commit is contained in:
6 files changed
+117
-160
No files matched your search
@@ -44,6 +44,7 @@
|
||||
import { isTabletViewport } from '$lib/stores/viewport';
|
||||
import { isCloud } from '$lib/system.js';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
let showSupport = false;
|
||||
|
||||
@@ -68,6 +69,10 @@
|
||||
: 'light'
|
||||
: theme;
|
||||
|
||||
trackEvent('select_theme', {
|
||||
value: theme === 'auto' ? 'system' : theme
|
||||
});
|
||||
|
||||
app.update(() => ({
|
||||
themeInUse: themeInUse,
|
||||
theme: theme
|
||||
@@ -130,12 +135,24 @@
|
||||
<Button.Anchor
|
||||
size="s"
|
||||
variant="primary"
|
||||
on:click={() => {
|
||||
trackEvent('click_organization_upgrade', {
|
||||
from: 'button',
|
||||
source: 'top_nav'
|
||||
});
|
||||
}}
|
||||
href={`${base}/organization-${currentOrg.$id}/change-plan`}
|
||||
>Upgrade</Button.Anchor>
|
||||
{/if}
|
||||
|
||||
<DropList show={$feedback.show} class="extended-width">
|
||||
<Button.Button type="button" variant="compact" on:click={() => toggleFeedback()}
|
||||
<Button.Button
|
||||
type="button"
|
||||
variant="compact"
|
||||
on:click={() => {
|
||||
toggleFeedback();
|
||||
trackEvent('click_menu_feedback', { source: 'top_nav' });
|
||||
}}
|
||||
>Feedback
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
@@ -152,7 +169,10 @@
|
||||
<Button.Button
|
||||
variant="compact"
|
||||
type="button"
|
||||
on:click={() => (showSupport = !showSupport)}>
|
||||
on:click={() => {
|
||||
showSupport = !showSupport;
|
||||
trackEvent('click_menu_support', { source: 'top_nav' });
|
||||
}}>
|
||||
Support
|
||||
</Button.Button>
|
||||
|
||||
@@ -174,6 +194,9 @@
|
||||
<Link.Button
|
||||
on:click={() => {
|
||||
showAccountMenu = !showAccountMenu;
|
||||
if (showAccountMenu) {
|
||||
trackEvent('click_menu_dropdown');
|
||||
}
|
||||
}}>
|
||||
<div style:user-select="none">
|
||||
<Avatar size="s" src={avatar} />
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
import MobileFeedbackModal from '$routes/(console)/wizard/feedback/mobileFeedbackModal.svelte';
|
||||
import { getSidebarState, updateSidebarState } from '$lib/helpers/sidebar';
|
||||
import { isTabletViewport } from '$lib/stores/viewport';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
type $$Props = HTMLElement & {
|
||||
state?: 'closed' | 'open' | 'icons';
|
||||
@@ -112,6 +113,7 @@
|
||||
class="progress-card"
|
||||
href={`/console/project-${project.$id}/get-started`}
|
||||
on:click={() => {
|
||||
trackEvent('click_menu_get_started');
|
||||
sideBarIsOpen = false;
|
||||
}}>
|
||||
<div class="progressCircle">
|
||||
@@ -139,6 +141,7 @@
|
||||
class="link"
|
||||
class:active={pathname.includes('overview')}
|
||||
on:click={() => {
|
||||
trackEvent('click_menu_overview');
|
||||
sideBarIsOpen = false;
|
||||
}}
|
||||
><span class="link-icon"
|
||||
@@ -166,6 +169,7 @@
|
||||
class="link"
|
||||
class:active={pathname.includes(projectOption.slug)}
|
||||
on:click={() => {
|
||||
trackEvent(`click_menu_${projectOption.slug}`);
|
||||
sideBarIsOpen = false;
|
||||
}}
|
||||
><span class="link-icon"
|
||||
@@ -183,7 +187,12 @@
|
||||
</div>
|
||||
<div class="only-mobile">
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a href={`/console/project-${project.$id}/settings`} class="link"
|
||||
<a
|
||||
href={`/console/project-${project.$id}/settings`}
|
||||
on:click={() => {
|
||||
trackEvent('click_menu_settings');
|
||||
}}
|
||||
class="link"
|
||||
><span class="link-icon"><Icon icon={IconCog} size="s" /></span
|
||||
><span
|
||||
class:no-text={state === 'icons'}
|
||||
@@ -201,7 +210,10 @@
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => toggleFeedback()}
|
||||
on:click={() => {
|
||||
toggleFeedback();
|
||||
trackEvent('click_menu_feedback', { source: 'side_nav' });
|
||||
}}
|
||||
>Feedback
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
@@ -213,7 +225,10 @@
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => ($showSupportModal = true)}>
|
||||
on:click={() => {
|
||||
$showSupportModal = true;
|
||||
trackEvent('click_menu_support', { source: 'side_nav' });
|
||||
}}>
|
||||
<span>Support</span>
|
||||
|
||||
<svelte:fragment slot="other">
|
||||
@@ -233,6 +248,9 @@
|
||||
<a
|
||||
href={`/console/project-${project.$id}/settings`}
|
||||
class="link"
|
||||
on:click={() => {
|
||||
trackEvent('click_menu_settings');
|
||||
}}
|
||||
class:active={isOnProjectSettings}
|
||||
><span class="link-icon"><Icon icon={IconCog} size="s" /></span><span
|
||||
class:no-text={state === 'icons'}
|
||||
@@ -252,7 +270,10 @@
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => toggleFeedback()}
|
||||
on:click={() => {
|
||||
toggleFeedback();
|
||||
trackEvent('click_menu_feedback', { source: 'side_nav' });
|
||||
}}
|
||||
><span>Feedback</span>
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
@@ -264,7 +285,10 @@
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => ($showSupportModal = true)}>
|
||||
on:click={() => {
|
||||
$showSupportModal = true;
|
||||
trackEvent('click_menu_support', { source: 'side_nav' });
|
||||
}}>
|
||||
<span>Support</span>
|
||||
|
||||
<svelte:fragment slot="other">
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Card, Heading } from '$lib/components';
|
||||
import { BillingPlan, Dependencies } from '$lib/constants';
|
||||
import { Button, Form, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import FormList from '$lib/elements/forms/formList.svelte';
|
||||
import { Container } from '$lib/layout';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { onMount } from 'svelte';
|
||||
import { tierToPlan, type Tier, plansInfo } from '$lib/stores/billing';
|
||||
import { formatCurrency } from '$lib/helpers/numbers';
|
||||
import { base } from '$app/paths';
|
||||
import { checkPricingRefAndRedirect } from '$lib/helpers/pricingRedirect';
|
||||
|
||||
let name: string;
|
||||
let plan: Tier;
|
||||
|
||||
const options = isCloud
|
||||
? [
|
||||
{
|
||||
value: BillingPlan.FREE,
|
||||
label: `${tierToPlan(BillingPlan.FREE).name} - ${formatCurrency($plansInfo.get(BillingPlan.FREE).price)} / month`
|
||||
},
|
||||
{
|
||||
value: BillingPlan.PRO,
|
||||
label: `${tierToPlan(BillingPlan.PRO).name} - ${formatCurrency($plansInfo.get(BillingPlan.PRO).price)} / month + add-ons`
|
||||
},
|
||||
{
|
||||
value: BillingPlan.SCALE,
|
||||
label: `${tierToPlan(BillingPlan.SCALE).name} - ${formatCurrency($plansInfo.get(BillingPlan.SCALE).price)}/month + usage`
|
||||
}
|
||||
]
|
||||
: [];
|
||||
|
||||
onMount(() => {
|
||||
if (isCloud) {
|
||||
checkPricingRefAndRedirect($page.url.searchParams);
|
||||
}
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
const orgName = name?.length ? name : 'Personal Projects';
|
||||
if (isCloud) {
|
||||
if (plan === BillingPlan.FREE) {
|
||||
try {
|
||||
const org = await sdk.forConsole.billing.createOrganization(
|
||||
ID.unique(),
|
||||
orgName,
|
||||
plan,
|
||||
null,
|
||||
null
|
||||
);
|
||||
trackEvent(Submit.OrganizationCreate, {
|
||||
plan: tierToPlan(plan)?.name
|
||||
});
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
await goto(`${base}/organization-${org.$id}`);
|
||||
addNotification({
|
||||
message: `${orgName} organization successfully created`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.OrganizationCreate);
|
||||
}
|
||||
} else {
|
||||
goto(`${base}/create-organization?name=${orgName}&plan=${plan}`);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
const org = await sdk.forConsole.teams.create(ID.unique(), orgName);
|
||||
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
await goto(`${base}/organization-${org.$id}`);
|
||||
|
||||
addNotification({
|
||||
message: `${orgName} organization successfully created`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.OrganizationCreate);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Container overlapCover size="large">
|
||||
<Card>
|
||||
<Heading size="4" tag="h2">Create a new organization</Heading>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<FormList gap={16}>
|
||||
<InputText
|
||||
id="name"
|
||||
label="Name"
|
||||
placeholder="Organization name"
|
||||
hideRequired
|
||||
bind:value={name} />
|
||||
{#if isCloud}
|
||||
<div class="u-margin-block-start-8">
|
||||
<h3><b>Plan</b></h3>
|
||||
<p>
|
||||
For more details on our plans, visit our <Button
|
||||
link
|
||||
external
|
||||
href="https://appwrite.io/pricing">pricing page</Button
|
||||
>.
|
||||
</p>
|
||||
<FormList class="u-margin-block-start-8">
|
||||
<InputSelect
|
||||
placeholder="Select a plan"
|
||||
label="Select plan"
|
||||
showLabel={false}
|
||||
id="plan"
|
||||
required
|
||||
hideRequired
|
||||
{options}
|
||||
bind:value={plan} />
|
||||
</FormList>
|
||||
</div>
|
||||
{/if}
|
||||
<Button
|
||||
fullWidth
|
||||
submit
|
||||
disabled={isCloud && !plan}
|
||||
event="create_organization"
|
||||
submissionLoader
|
||||
let:isSubmitting>
|
||||
{#if isSubmitting}
|
||||
Creating your first organization
|
||||
{:else}
|
||||
Get started
|
||||
{/if}
|
||||
</Button>
|
||||
</FormList>
|
||||
</Form>
|
||||
</Card>
|
||||
</Container>
|
||||
@@ -10,6 +10,7 @@
|
||||
import { user } from '$lib/stores/user';
|
||||
import { isSmallViewport } from '$lib/stores/viewport';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
</script>
|
||||
|
||||
{#if !$page.url.pathname.includes('get-started')}
|
||||
@@ -45,6 +46,7 @@
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={async () => {
|
||||
trackEvent('onboarding_hub_platform_dismiss');
|
||||
await setHasOnboardingDismissed($project.$id);
|
||||
goto(`${base}/project-${$project.$id}/overview`);
|
||||
requestAnimationFrame(() => {
|
||||
|
||||
@@ -37,8 +37,15 @@
|
||||
import { AvatarGroup } from '$lib/components';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { getPlatformInfo } from '$lib/helpers/platform';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
function createKey() {
|
||||
trackEvent('onboarding_hub_platform', {
|
||||
platform: 'server',
|
||||
state: 'add'
|
||||
});
|
||||
wizard.start(Wizard);
|
||||
}
|
||||
|
||||
@@ -386,7 +393,12 @@
|
||||
<Layout.Stack
|
||||
gap="l"
|
||||
direction={$isSmallViewport ? 'column' : 'row'}>
|
||||
<Card.Button on:click={() => addPlatform(0)} padding="s"
|
||||
<Card.Button
|
||||
on:click={() => {
|
||||
trackEvent('onboarding_hub_setup_databases');
|
||||
goto(`${base}/project-${projectId}/databases`);
|
||||
}}
|
||||
padding="s"
|
||||
><Layout.Stack gap="xl"
|
||||
><div
|
||||
class="card-top-image database-card-image"
|
||||
@@ -419,20 +431,38 @@
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href="https://appwrite.io/docs/references"
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_api_references'
|
||||
);
|
||||
}}
|
||||
target="_blank">API references</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href="https://appwrite.io/docs/tutorials"
|
||||
on:click={() => {
|
||||
trackEvent('onboarding_hub_tutorials');
|
||||
}}
|
||||
target="_blank">Tutorials</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href="https://appwrite.io/docs/products/storage/quick-start"
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_storage_quick_start'
|
||||
);
|
||||
}}
|
||||
target="_blank"
|
||||
>Storage quick start
|
||||
</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href="https://appwrite.io/docs/products/functions/quick-start"
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_functions_quick_start'
|
||||
);
|
||||
}}
|
||||
target="_blank"
|
||||
>Functions quick start</Link.Anchor>
|
||||
</Layout.Stack>
|
||||
@@ -458,16 +488,29 @@
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href={`${base}/project-${projectId}/auth/settings`}
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_auth_email_password'
|
||||
);
|
||||
}}
|
||||
>E-mail and password
|
||||
</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href={`${base}/project-${projectId}/auth/settings`}
|
||||
>OAuth 2</Link.Anchor>
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_auth_oauth2'
|
||||
);
|
||||
}}>OAuth 2</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href={`${base}/project-${projectId}/auth/settings`}
|
||||
>View all methods</Link.Anchor>
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_auth_all_methods'
|
||||
);
|
||||
}}>View all methods</Link.Anchor>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
<div
|
||||
@@ -481,7 +524,12 @@
|
||||
</div></Card.Base>
|
||||
</div>
|
||||
|
||||
<Card.Link href="https://appwrite.io/discord" padding="s">
|
||||
<Card.Link
|
||||
href="https://appwrite.io/discord"
|
||||
padding="s"
|
||||
on:click={() => {
|
||||
trackEvent('onboarding_hub_discord');
|
||||
}}>
|
||||
<div class="full-height-card">
|
||||
<Layout.Stack gap="xs" justifyContent="space-between">
|
||||
<Layout.Stack direction="column" gap="xxxs">
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import CreateReactNative from './createReactNative.svelte';
|
||||
import CreateWeb from './createWeb.svelte';
|
||||
import { createPlatform, versions } from './wizard/store';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
export enum Platform {
|
||||
Web,
|
||||
@@ -20,6 +21,10 @@
|
||||
export async function addPlatform(type: Platform) {
|
||||
await versions.load();
|
||||
createPlatform.reset();
|
||||
trackEvent('onboarding_hub_platform', {
|
||||
platform: platforms[type],
|
||||
state: 'add'
|
||||
});
|
||||
wizard.start(platforms[type]);
|
||||
}
|
||||
|
||||
@@ -35,6 +40,10 @@
|
||||
key: key,
|
||||
type: type
|
||||
});
|
||||
trackEvent('onboarding_hub_platform', {
|
||||
platform: platforms[platform],
|
||||
state: 'continue'
|
||||
});
|
||||
wizard.start(platforms[platform], null, 1, {
|
||||
isPlatformCreated: true,
|
||||
platform: type,
|
||||
|
||||
Reference in new issue
Block a user