Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
虎纹鲨鱼
avatar
提交
11412141
A
avatar
项目概览
虎纹鲨鱼
/
avatar
通知
5
Star
254
Fork
107
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avatar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
11412141
编写于
10月 19, 2021
作者:
L
LeoKu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: add analytics
上级
0f472800
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
17 deletion
+47
-17
jest.config.js
jest.config.js
+1
-1
public/tencent14464934467995274316.txt
public/tencent14464934467995274316.txt
+0
-1
src/App.vue
src/App.vue
+27
-7
src/env.d.ts
src/env.d.ts
+1
-1
src/layouts/Header.vue
src/layouts/Header.vue
+9
-1
src/utils/ga.ts
src/utils/ga.ts
+9
-6
未找到文件。
jest.config.js
浏览文件 @
11412141
...
...
@@ -10,7 +10,7 @@ module.exports = {
clearMocks
:
true
,
collectCoverage
:
tru
e
,
collectCoverage
:
fals
e
,
coverageDirectory
:
'
coverage
'
,
...
...
public/tencent14464934467995274316.txt
已删除
100644 → 0
浏览文件 @
0f472800
235605460366578863
\ No newline at end of file
src/App.vue
浏览文件 @
11412141
...
...
@@ -91,7 +91,7 @@ import {
NOT_COMPATIBLE_AGENTS
,
TRIGGER_PROBABILITY
,
}
from
'
@/utils/constant
'
import
{
record
Click
}
from
'
@/utils/ga
'
import
{
record
Event
}
from
'
@/utils/ga
'
import
Confetti
from
'
./components/Confetti.vue
'
...
...
@@ -117,6 +117,10 @@ function handleGenerate() {
const
randomOption
=
getRandomAvatarOption
(
avatarOption
.
value
)
setAvatarOption
(
randomOption
)
}
recordEvent
(
'
click_randomize
'
,
{
event_category
:
'
click
'
,
}
)
}
const
downloadModalVisible
=
ref
(
false
)
...
...
@@ -150,6 +154,10 @@ async function handleDownload() {
trigger
.
click
()
}
}
recordEvent
(
'
click_download
'
,
{
event_category
:
'
click
'
,
}
)
}
finally
{
setTimeout
(()
=>
{
downloading
.
value
=
false
...
...
@@ -164,21 +172,33 @@ function handleAction(actionType: ActionType) {
switch
(
actionType
)
{
case
ActionType
.
Undo
:
store
.
commit
(
UNDO
)
recordEvent
(
'
action_undo
'
,
{
event_category
:
'
action
'
,
event_label
:
'
Undo
'
,
}
)
break
case
ActionType
.
Redo
:
store
.
commit
(
REDO
)
recordEvent
(
'
action_redo
'
,
{
event_category
:
'
action
'
,
event_label
:
'
Redo
'
,
}
)
break
case
ActionType
.
Flip
:
flipped
.
value
=
!
flipped
.
value
recordEvent
(
'
action_flip_avatar
'
,
{
event_category
:
'
action
'
,
event_label
:
'
Flip Avatar
'
,
}
)
break
case
ActionType
.
Code
:
codeVisible
.
value
=
!
codeVisible
.
value
record
Click
(
{
event_category
:
'
code
'
,
event_label
:
'
view c
ode
'
,
record
Event
(
'
action_view_code
'
,
{
event_category
:
'
action
'
,
event_label
:
'
View Avatar Option C
ode
'
,
}
)
break
}
...
...
@@ -267,7 +287,7 @@ function handleAction(actionType: ActionType) {
height
:
100
%
;
overflow
:
hidden
;
@
mixin
gradient
-
block
(
$color
)
{
@
mixin
gradient
-
style
(
$color
)
{
position
:
absolute
;
width
:
100
vh
;
height
:
100
vh
;
...
...
@@ -284,14 +304,14 @@ function handleAction(actionType: ActionType) {
}
.
gradient
-
top
{
@
include
gradient
-
block
(
$color
-
secondary
);
@
include
gradient
-
style
(
$color
-
secondary
);
top
:
-
50
%
;
right
:
-
20
%
;
}
.
gradient
-
bottom
{
@
include
gradient
-
block
(
$color
-
accent
);
@
include
gradient
-
style
(
$color
-
accent
);
bottom
:
-
50
%
;
left
:
-
20
%
;
...
...
src/env.d.ts
浏览文件 @
11412141
...
...
@@ -9,5 +9,5 @@ declare module '*.vue' {
interface
Window
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
gtag
:
any
gtag
:
(...
params
:
any
[])
=>
void
}
src/layouts/Header.vue
浏览文件 @
11412141
...
...
@@ -10,7 +10,14 @@
target=
"_blank"
rel=
"nofollow noopener noreferrer"
>
<button
class=
"github-button"
>
<button
class=
"github-button"
@
click=
"
recordEvent('click_github',
{
event_category: 'click',
})
"
>
<img
:src=
"IconGitHub"
alt=
"GitHub"
/>
<span
class=
"text"
>
GitHub
</span>
</button>
...
...
@@ -22,6 +29,7 @@
<
script
lang=
"ts"
setup
>
import
IconGitHub
from
'
@/assets/icons/icon-github.svg
'
import
Logo
from
'
@/components/Logo.vue
'
import
{
recordEvent
}
from
'
@/utils/ga
'
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
src/utils/ga.ts
浏览文件 @
11412141
export
function
recordClick
(
params
:
{
event_category
:
string
event_label
?:
string
value
?:
number
})
{
window
?.
gtag
(
'
event
'
,
'
Click
'
,
params
)
export
function
recordEvent
(
action
:
string
,
params
:
{
event_category
:
string
event_label
?:
string
value
?:
number
}
)
{
window
?.
gtag
(
'
event
'
,
action
,
params
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录