Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Feat plugin analytics #206

Merged
merged 6 commits into from
Dec 10, 2021
Merged

Feat plugin analytics #206

merged 6 commits into from
Dec 10, 2021

Conversation

YdreamW
Copy link
Contributor

@YdreamW YdreamW commented Dec 9, 2021

No description provided.


api.addHTMLHeadScripts(() => {
const { analytics = {} } = api.config;
const { ga = GA_KEY, baidu = undefined } = analytics;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥加 = undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该是之前的写法,现在似乎用不到了,我删一下。

const rt = [];
baidu &&
rt.push({
content: 'var _hmt = _hmt || [];',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev 阶段为啥需要加这个?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

百度的事件跟踪需要加这个: 在 JS 中调用事件跟踪代码。 window._hmt.push(['_trackEvent', category, action, opt_label, opt_value]); https://umijs.org/zh-CN/plugins/plugin-analytics

@sorrycc sorrycc merged commit d346433 into umijs:master Dec 10, 2021
@YdreamW YdreamW mentioned this pull request Dec 23, 2021
80 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants