feat: track and push TeleCart Pulse events
This commit is contained in:
@@ -8,7 +8,7 @@ import {useSettingsStore} from "@/stores/SettingsStore.js";
|
||||
import ApplicationError from "@/ApplicationError.vue";
|
||||
import AppMetaInitializer from "@/utils/AppMetaInitializer.ts";
|
||||
import {injectYaMetrika} from "@/utils/yaMetrika.js";
|
||||
import {checkIsUserPrivacyConsented, ingest, saveTelegramCustomer} from "@/utils/ftch.js";
|
||||
import {checkIsUserPrivacyConsented} from "@/utils/ftch.js";
|
||||
|
||||
import {register} from 'swiper/element/bundle';
|
||||
import 'swiper/element/bundle';
|
||||
@@ -20,6 +20,7 @@ import {getCssVarOklchRgb} from "@/helpers.js";
|
||||
import {defaultConfig, plugin} from '@formkit/vue';
|
||||
import config from './formkit.config.js';
|
||||
import {TC_PULSE_EVENTS} from "@/constants/tPulseEvents.js";
|
||||
import {usePulseStore} from "@/stores/Pulse.js";
|
||||
|
||||
register();
|
||||
|
||||
@@ -34,6 +35,7 @@ app
|
||||
|
||||
const settings = useSettingsStore();
|
||||
const blocks = useBlocksStore();
|
||||
const pulse = usePulseStore();
|
||||
|
||||
const appLoading = createApp(AppLoading);
|
||||
appLoading.mount('#app');
|
||||
@@ -51,24 +53,9 @@ settings.load()
|
||||
throw new Error('App disabled (maintenance mode)');
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
const webapp = window.Telegram.WebApp;
|
||||
ingest({
|
||||
event: TC_PULSE_EVENTS.WEBAPP_OPEN,
|
||||
webapp,
|
||||
})
|
||||
.catch(err => console.error('Ingest failed:', err));
|
||||
})
|
||||
.then(() => {
|
||||
// Сохраняем данные Telegram-пользователя в базу данных
|
||||
const userData = window.Telegram?.WebApp?.initDataUnsafe?.user;
|
||||
if (userData) {
|
||||
console.debug('[Init] Saving Telegram customer data');
|
||||
saveTelegramCustomer(userData)
|
||||
.then(() => console.debug('[Init] Telegram customer data saved successfully'))
|
||||
.catch(() => console.warn('[Init] Failed to save Telegram customer data:', error));
|
||||
}
|
||||
})
|
||||
.then(() => pulse.initFromStartParams())
|
||||
.then(() => pulse.catchTelegramCustomerFromInitData())
|
||||
.then(() => pulse.ingest(TC_PULSE_EVENTS.WEBAPP_OPEN))
|
||||
.then(() => {
|
||||
(async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user