AW-68-userIdYandexMetric

This commit is contained in:
Денис Катаев 2024-05-06 19:48:29 +00:00 committed by Daniil Chemerkin
parent 1f51ec4ec2
commit f22bd2cbea
3 changed files with 16 additions and 1 deletions

View File

@ -174,6 +174,7 @@ export interface ICreateAuthorizePayload {
export interface ICreateAuthorizeResponse {
token: string;
userId?: string;
}
export const createAuthorizeRequest = (data: ICreateAuthorizePayload): Request => {

View File

@ -114,7 +114,13 @@ export const useAuthentication = () => {
try {
setIsLoading(true);
const payload = getAuthorizationPayload(email, source);
const { token } = await api.authorization(payload);
const { token, userId } = await api.authorization(payload);
if (userId?.length && !!window.ym) {
window.ym(95799066, 'userParams', {
UserID: userId
})
window.ym(95799066, 'setUserID', userId);
}
const { user } = await api.getUser({ token });
signUp(token, user);
setToken(token);

View File

@ -22,3 +22,11 @@ export interface SignupForm {
}
export type UserStatus = "lead" | "registred" | "subscribed" | "unsubscribed";
declare global {
interface Window {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ym: any;
}
}