-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Модуль с функциями отправки событий статистики в счетчики #1
base: main
Are you sure you want to change the base?
Conversation
curly: ['error', 'all'], | ||
quotes: ['error', 'single'], | ||
'no-alert': 'error', | ||
'no-console': 'warn', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может вернуть error
? В либе думаю не нужны лишние выводы в консоль
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нужно для вывода ошибок в консоль об отправки статистики
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавить флаг debug в init, при true - выводить ошибки в консоль
src/statsEvent.ts
Outdated
* @property {string=} event - id события | ||
* @property {string=} title - название действия по событию | ||
* @property {string=} category - категория события | ||
* @property {Object=} rest - дополнительные параметры |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Разве они устанавливаются по умолчанию?
* @property {ActionType=} action - event, title события | ||
* @property {string=} category - категория события | ||
* @property {Object=} rest - дополнительные параметры |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тоже вроде по умолчанию не устанавливаются
const pages = { | ||
start: { | ||
path: '/start', | ||
title: categories.start, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут наверное лучше читаемое название указать
…sspecials в один параметр инициализации
CHANGELOG.md
Outdated
@@ -0,0 +1,2 @@ | |||
### v1.0.0 | |||
- [+] статистика |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не очень подробно...
@@ -0,0 +1,77 @@ | |||
import 'whatwg-fetch'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а в чем преимущества такого фетча?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это полифилл для настоящего fetch. он есть в новых браузерах (https://caniuse.com/fetch), мне кажется, пользователи, у которых старые версии все еще могут существовать:
src/sendVKEvents.ts
Outdated
json: '', | ||
}, | ||
], | ||
v: '5.124', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вроде актуальная версия повыше уже
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я не уверена, какие в актуальной версии поля в закрытом вкшном методе статы(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ввела переменную version, куда можно передавать версию api
src/sendVKEvents.ts
Outdated
access_token: access_token_for_vkstats, | ||
}, | ||
}); | ||
} catch (e: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мб типизируем тут ошибку?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ошибка может быть либо unknown, либо any, так задумано ts.
microsoft/TypeScript#20024
можно написать:
catch (e: unknown) {
const error = e as ErrorData;
}
* Top Mail | ||
* KTS статистика | ||
* ВК ститистика |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
статистика
* VK Retargeting | ||
* Snitch | ||
* Писели |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пиксели?
userId: window.user_id, | ||
}); | ||
``` | ||
|
||
### метод setUserId | ||
```sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут какой-то пример должен быть?
SEARCH: KTS_DATA_SAVE?.KTS_TOKEN || '', | ||
KTS_TOKEN: KTS_EVENT_REGISTER?.SEARCH || '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не поняла, почему токен в search, а search в токене
KTS_PROJECT_NAME && | ||
KTS_TOKEN && | ||
!SEARCH && | ||
KTS_STATS_URL && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вообще может в __params__
такую же структуру оставить, как в аргументах init
? Тип поля KTS_DATA_SAVE
и KTS_EVENT_REGISTER
, и они либо null
, либо со всей нужной инфой. Чтобы не путаться в этих условиях
headers, | ||
}); | ||
} catch (e) { | ||
console.error('stat kts error', e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ошибки в итоге будут в консоли?
No description provided.