Skip to content

Commit

Permalink
添加搜索、通知和节点页面埋点事件
Browse files Browse the repository at this point in the history
  • Loading branch information
eternaljust committed Feb 23, 2023
1 parent 39f4194 commit 382ee16
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ fun SearchPage(
message = "站内搜索请先登录"
)
} else {
StatisticsTool.instance.eventObject(
context = context,
resId = R.string.event_page_search,
keyAndValue = mapOf(R.string.key_search to items[pagerState.currentPage].title)
)
scaffoldState.showSnackbar(
message = if (viewModel.viewStates.keyword.isEmpty()) "请输入搜索关键字!"
else "正在搜索\"${viewModel.viewStates.keyword}\""
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/java/com/eternaljust/msea/ui/page/node/NodePage.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.eternaljust.msea.ui.page.node

import android.content.Context
import android.net.Uri
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
Expand Down Expand Up @@ -121,6 +122,7 @@ private fun NodeContent(
R.string.key_source to "分区版主"
)
)
eventObject(context, mapOf(R.string.key_action to "个人空间"))
}
}

Expand All @@ -129,6 +131,7 @@ private fun NodeContent(
item = item,
nodeClick = {
navController.navigate(RouteName.NODE_LIST + "/${item.fid}")
eventObject(context, mapOf(R.string.key_forum to item.title))
},
nicknameClick = {
val route = RouteName.PROFILE_DETAIL_USERNAME + "/${item.username}"
Expand All @@ -140,6 +143,7 @@ private fun NodeContent(
R.string.key_source to "节点"
)
)
eventObject(context, mapOf(R.string.key_action to "个人空间"))
},
contentClick = {
val topic = TopicDetailRouteModel(
Expand All @@ -155,6 +159,7 @@ private fun NodeContent(
R.string.key_source to "节点"
)
)
eventObject(context, mapOf(R.string.key_action to "帖子详情"))
}
)
}
Expand Down Expand Up @@ -441,4 +446,15 @@ private fun NodeCategoryIcon(fid: String) = when (fid) {
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(40.dp)
)
}

private fun eventObject(
context: Context,
params: Map<Int, String>
) {
StatisticsTool.instance.eventObject(
context = context,
resId = R.string.event_page_node,
keyAndValue = params
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ fun InteractivePage(
R.string.key_source to NoticeTabItem.INTERACTIVE.title
)
)
StatisticsTool.instance.eventObject(
context = context,
resId = R.string.event_page_notice,
keyAndValue = mapOf(
R.string.key_action to "个人空间"
)
)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ fun MyPostPage(
R.string.key_source to NoticeTabItem.MYPOST.title
)
)
StatisticsTool.instance.eventObject(
context = context,
resId = R.string.event_page_notice,
keyAndValue = mapOf(
R.string.key_action to "个人空间"
)
)
},
contentClick = {
val topic = TopicDetailRouteModel(tid = it.ptid)
Expand All @@ -74,6 +81,13 @@ fun MyPostPage(
R.string.key_source to "我的帖子"
)
)
StatisticsTool.instance.eventObject(
context = context,
resId = R.string.event_page_notice,
keyAndValue = mapOf(
R.string.key_action to "帖子详情"
)
)
},
forumClick = {
navController.navigate(RouteName.NODE_LIST + "/${item.fid}")
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,14 @@
<string name="key_sign">key_sign</string>
<!-- 签到结果 -->
<string name="key_sign_result">key_sign_result</string>
<!-- 搜索 -->
<string name="event_page_search">event_page_search</string>
<!-- 搜索类型 -->
<string name="key_search">key_search</string>
<!-- 通知 -->
<string name="event_page_notice">event_page_notice</string>
<!-- 节点 -->
<string name="event_page_node">event_page_node</string>
<!-- 节点板块 -->
<string name="key_forum">key_forum</string>
</resources>

0 comments on commit 382ee16

Please sign in to comment.