feat: events

This commit is contained in:
Arman
2024-07-12 11:19:28 +02:00
parent 9e3e302717
commit 26f294a578
2 changed files with 7 additions and 6 deletions
@@ -15,14 +15,15 @@
const now = new Date().getTime();
localStorage.setItem($activeHeaderAlert.id, now.toString());
trackEvent('close_upgrade_banner', {
source: 'upgrade_banner'
source: 'cloud_credits_banner',
campaign: 'WelcomeManual'
});
}
</script>
{#if show && $organization?.$id && $organization?.billingPlan === BillingPlan.FREE && !$page.url.pathname.includes('/console/account')}
<GradientBanner on:close={handleClose}>
<div class="u-flex u-gap-16 u-main-center u-cross-center u-flex-vertical-mobile">
<div class="u-flex u-gap-24 u-main-center u-cross-center u-flex-vertical-mobile">
<span class="body-text-1">Get $50 Cloud credits for Appwrite Pro.</span>
<Button
secondary
@@ -30,9 +31,10 @@
class="u-line-height-1"
href={`${base}/console/apply-credit?code=appw50&org=${$organization.$id}`}
on:click={() => {
trackEvent('click_organization_upgrade', {
trackEvent('click_credits_redeem', {
from: 'button',
source: 'upgrade_banner'
source: 'cloud_credits_banner',
campaign: 'WelcomeManual'
});
}}>
Claim credits
+1 -2
View File
@@ -391,7 +391,6 @@ export async function checkForMissingPaymentMethod() {
}
}
//TODO: re-enable conditions
// Display upgrade banner for new users after 1 week for 30 days
export async function checkForNewDevUpgradePro(org: Organization) {
if (org?.billingPlan !== BillingPlan.FREE || !browser) return;
@@ -404,7 +403,7 @@ export async function checkForNewDevUpgradePro(org: Organization) {
const now = new Date().getTime();
const account = get(user);
const accountCreated = new Date(account.$createdAt).getTime();
// if (now - accountCreated < 1000 * 60 * 60 * 24 * 7) return;
if (now - accountCreated < 1000 * 60 * 60 * 24 * 7) return;
const isDismissed = !!localStorage.getItem('newDevUpgradePro');
if (isDismissed) return;
if (now - accountCreated < 1000 * 60 * 60 * 24 * 37) {