Files
bedolaga-cabinet/src/utils/yandexCid.ts
Fringg 80059681da feat: Yandex Metrika CID tracking, offline conversions UI, sticky pay button
- Pass yandex_cid to all auth endpoints (telegram, email, OIDC, OAuth)
- Add OfflineConvGoal interface and offline_conv_* fields to AnalyticsCounters
- Add storeYandexCid API method for server-side CID persistence
- Add analytics fields to LandingConfig (view/click goals, sticky_pay_button)
- Add yandex_cid/referrer/subid to PurchaseRequest
- Add offline conversions UI block in admin AnalyticsTab
- Add cacheYandexCid, syncYandexCid, fireAnalyticsEvent to analytics hook
- Create yandexCid.ts utility (localStorage get/set helpers)
- Add sticky pay button with portal on mobile in QuickPurchase
- Fire view/click analytics goals on landing pages
- Persist contact value and referrer/subid in session/localStorage
- Add i18n keys for offlineConv and apiKey in all 4 locales
2026-04-29 08:59:19 +03:00

26 lines
580 B
TypeScript

/**
* Yandex Metrika ClientID helpers.
*
* Lives in `utils/` (not `hooks/`) so that both the `api/` layer
* (auth.ts, oauth.ts) and React hooks can read the cached CID
* without `api/` accidentally importing from `hooks/`.
*/
const STORAGE_KEY = 'ym_client_id';
export function getYandexCid(): string | null {
try {
return localStorage.getItem(STORAGE_KEY);
} catch {
return null;
}
}
export function setYandexCid(cid: string): void {
try {
localStorage.setItem(STORAGE_KEY, cid);
} catch {
/* sandboxed iframe / private mode -- ignore */
}
}