add: trackEvents for promo modals.

This commit is contained in:
ItzNotABug
2024-10-01 20:59:12 +05:30
parent 6406b55520
commit 619c0241d2
+10 -1
View File
@@ -15,10 +15,13 @@
import { addBottomModalAlerts } from '$routes/(console)/bottomAlerts';
import { project } from '$routes/(console)/project-[project]/store';
import { page } from '$app/stores';
import { trackEvent } from '$lib/actions/analytics';
let currentIndex = 0;
let openModalOnMobile = false;
const promoId = (alertId: string) => alertId.replace(/(banner:|modal:)/g, '');
function getPageScope(pathname: string) {
const isProjectPage = pathname.includes('project-[project]');
const isOrganizationPage = pathname.includes('organization-[organization]');
@@ -167,7 +170,13 @@
project: $project
})}
external={!!currentModalAlert.cta.external}
fullWidthMobile>
fullWidthMobile
on:click={() => {
trackEvent('click_promo', {
promo: promoId(currentModalAlert.id),
type: shouldShowUpgrade ? 'upgrade' : 'try_now'
});
}}>
{currentModalAlert.cta.text}
</Button>