Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
ShenghuoquanBusiness
Commits
4ff448c3
Commit
4ff448c3
authored
Sep 26, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 订单详情页埋点
parent
2a29cfd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
111 deletions
+6
-111
OrderDetailActivity.kt
.../yidian/shenghuoquan/buserorder/ui/OrderDetailActivity.kt
+2
-2
OrderDetailViewModel.kt
...shenghuoquan/buserorder/viewmodel/OrderDetailViewModel.kt
+4
-109
No files found.
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/buserorder/ui/OrderDetailActivity.kt
View file @
4ff448c3
...
...
@@ -58,6 +58,7 @@ class OrderDetailActivity : BaseMvvmActivity<BorderActivityOrderDetailBinding, O
binding
.
ivOrderInfo
.
setOrderInfo
(
status
,
it
)
})
binding
.
rlOrderDetail
.
autoRefresh
()
vm
.
commitExposePageBuriedPoint
()
}
private
fun
initSmartRefresh
()
{
...
...
@@ -70,7 +71,6 @@ class OrderDetailActivity : BaseMvvmActivity<BorderActivityOrderDetailBinding, O
}
override
fun
onDoBack
()
{
// vm.commitWidgetBuriedPoint("return_key")
XPageManager
.
pop
(
null
)
}
...
...
@@ -79,7 +79,7 @@ class OrderDetailActivity : BaseMvvmActivity<BorderActivityOrderDetailBinding, O
}
override
fun
onGotoMarketingDetail
()
{
// vm.commitWidgetBuriedPoint("activity_icon")
}
override
fun
onApplyRefundSuccess
()
{
...
...
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/buserorder/viewmodel/OrderDetailViewModel.kt
View file @
4ff448c3
package
com.yidian.shenghuoquan.buserorder.viewmodel
import
android.text.TextUtils
import
androidx.lifecycle.LiveData
import
androidx.lifecycle.MutableLiveData
import
com.yidian.bcommon.mvvm.BaseViewModel
...
...
@@ -8,8 +7,6 @@ import com.yidian.bcommon.utils.CPointUtils
import
com.yidian.shenghuoquan.buserorder.dto.OrderDetailDto
import
com.yidian.shenghuoquan.buserorder.http.OrderRemoteDataSource
import
com.yidian.shenghuoquan.buserorder.http.callback.IGetOrderDetailCallback
import
com.yidian.shenghuoquan.buserorder.manager.OrderStatus
import
com.yidian.shenghuoquan.buserorder.manager.OrderStatusManager
import
org.json.JSONObject
import
timber.log.Timber
...
...
@@ -29,19 +26,6 @@ class OrderDetailViewModel : BaseViewModel() {
fun
requestOrderDetail
(
orderId
:
String
)
{
OrderRemoteDataSource
.
getOrderDetail
(
object
:
IGetOrderDetailCallback
{
override
fun
getOrderDetailSuccess
(
result
:
OrderDetailDto
?)
{
if
(
_orderDetailData
.
value
==
null
)
{
_orderDetailData
.
value
=
result
if
(
result
==
null
)
return
// 订单详情按钮曝光埋点只上报一次
if
(!
TextUtils
.
isEmpty
(
result
.
placeList
.
phone
))
{
commitViewWidgetBuriedPoint
(
"call_up"
)
}
commitViewWidgetBuriedPoint
(
"contact_seller"
)
if
(
OrderStatusManager
.
getOrderStatus
(
result
.
orderStatus
)
==
OrderStatus
.
ORDER_STATUS_PAID
)
{
commitViewWidgetBuriedPoint
(
"apply_refund"
)
}
return
}
_orderDetailData
.
value
=
result
}
...
...
@@ -52,88 +36,23 @@ class OrderDetailViewModel : BaseViewModel() {
}
/**
* 页面浏览的埋点
* 页面可见且有业务数据时上传
* 页面曝光埋点
*/
private
fun
commitPageBuriedPoint
()
{
val
data
=
_orderDetailData
.
value
// 遍历商品列表
val
skuIdStr
=
StringBuilder
()
val
skuNameStr
=
StringBuilder
()
data
?.
mergeOrderItemList
?.
forEachIndexed
{
index
,
item
->
skuIdStr
.
append
(
item
.
goodsSkuId
)
skuNameStr
.
append
(
item
.
goodsName
)
if
(
index
<
data
.
mergeOrderItemList
.
size
-
1
)
{
skuIdStr
.
append
(
","
)
skuNameStr
.
append
(
","
)
}
}
fun
commitExposePageBuriedPoint
()
{
// 埋点数据包装
val
jsonObject
=
JSONObject
()
jsonObject
.
put
(
"eventName"
,
"EXPOSE_PAGE"
)
val
contextJsonObject
=
JSONObject
()
contextJsonObject
.
put
(
"page"
,
"ORDER_DETAIL_PAGE"
)
val
smallOrderInfoJsonObject
=
JSONObject
()
smallOrderInfoJsonObject
.
put
(
"order_id"
,
data
?.
orderId
)
smallOrderInfoJsonObject
.
put
(
"marketing_id"
,
data
?.
marketingId
)
smallOrderInfoJsonObject
.
put
(
"marketing_name"
,
data
?.
marketingName
)
smallOrderInfoJsonObject
.
put
(
"marketing_type"
,
"SPELL_MEAL"
)
smallOrderInfoJsonObject
.
put
(
"goods_sku_id"
,
skuIdStr
.
toString
())
smallOrderInfoJsonObject
.
put
(
"goods_sku_name"
,
skuNameStr
.
toString
())
contextJsonObject
.
put
(
"small_order_info"
,
smallOrderInfoJsonObject
)
jsonObject
.
put
(
"contextMap"
,
contextJsonObject
)
val
propertiesJsonObject
=
JSONObject
()
propertiesJsonObject
.
put
(
"event_id"
,
"SHQNG_R_16
28750600250
"
)
propertiesJsonObject
.
put
(
"event_id"
,
"SHQNG_R_16
32389947033
"
)
jsonObject
.
put
(
"propertiesMap"
,
propertiesJsonObject
)
jsonObject
.
put
(
"logType"
,
1
)
CPointUtils
.
performCommitLog
(
jsonObject
)
Timber
.
tag
(
"BUserOrderBuriedPoint"
).
d
(
"commit order detail page log: $jsonObject"
)
}
/**
* 点击返回按钮的埋点
*/
fun
commitWidgetBuriedPoint
(
widgetName
:
String
)
{
val
data
=
_orderDetailData
.
value
// 遍历商品列表
val
skuIdStr
=
StringBuilder
()
val
skuNameStr
=
StringBuilder
()
data
?.
mergeOrderItemList
?.
forEachIndexed
{
index
,
item
->
skuIdStr
.
append
(
item
.
goodsSkuId
)
skuNameStr
.
append
(
item
.
goodsName
)
if
(
index
<
data
.
mergeOrderItemList
.
size
-
1
)
{
skuIdStr
.
append
(
","
)
skuNameStr
.
append
(
","
)
}
}
// 埋点数据包装
val
jsonObject
=
JSONObject
()
jsonObject
.
put
(
"eventName"
,
"CLICK_WIDGET"
)
val
contextJsonObject
=
JSONObject
()
contextJsonObject
.
put
(
"page"
,
"ORDER_DETAIL_PAGE"
)
val
smallOrderInfoJsonObject
=
JSONObject
()
smallOrderInfoJsonObject
.
put
(
"order_id"
,
data
?.
orderId
)
smallOrderInfoJsonObject
.
put
(
"marketing_id"
,
data
?.
marketingId
)
smallOrderInfoJsonObject
.
put
(
"marketing_name"
,
data
?.
marketingName
)
smallOrderInfoJsonObject
.
put
(
"marketing_type"
,
"SPELL_MEAL"
)
smallOrderInfoJsonObject
.
put
(
"goods_sku_id"
,
skuIdStr
.
toString
())
smallOrderInfoJsonObject
.
put
(
"goods_sku_name"
,
skuNameStr
.
toString
())
contextJsonObject
.
put
(
"small_order_info"
,
smallOrderInfoJsonObject
)
jsonObject
.
put
(
"contextMap"
,
contextJsonObject
)
val
entitiesJsonObject
=
JSONObject
()
val
widgetInfoJsonObject
=
JSONObject
()
widgetInfoJsonObject
.
put
(
"widget_type"
,
"BUTTON"
)
widgetInfoJsonObject
.
put
(
"widget_name"
,
widgetName
)
entitiesJsonObject
.
put
(
"widget_info"
,
widgetInfoJsonObject
)
jsonObject
.
put
(
"entitiesMap"
,
entitiesJsonObject
)
val
propertiesJsonObject
=
JSONObject
()
propertiesJsonObject
.
put
(
"event_id"
,
"SHQNG_R_1628751452736"
)
jsonObject
.
put
(
"propertiesMap"
,
propertiesJsonObject
)
jsonObject
.
put
(
"logType"
,
1
)
CPointUtils
.
performCommitLog
(
jsonObject
)
Timber
.
tag
(
"BUserOrderBuriedPoint"
).
d
(
"commit order detail widget log: $jsonObject"
)
}
/**
* 按钮点击埋点
*/
...
...
@@ -151,31 +70,7 @@ class OrderDetailViewModel : BaseViewModel() {
entitiesJsonObject
.
put
(
"widget_info"
,
widgetInfoJsonObject
)
jsonObject
.
put
(
"entitiesMap"
,
entitiesJsonObject
)
val
propertiesJsonObject
=
JSONObject
()
propertiesJsonObject
.
put
(
"event_id"
,
"SHQ_R_1625468015092"
)
jsonObject
.
put
(
"propertiesMap"
,
propertiesJsonObject
)
jsonObject
.
put
(
"logType"
,
1
)
CPointUtils
.
performCommitLog
(
jsonObject
)
Timber
.
tag
(
"BUserOrderBuriedPoint"
).
d
(
"commit order detail widget log: $jsonObject"
)
}
/**
* 按钮曝光埋点
*/
fun
commitViewWidgetBuriedPoint
(
widgetName
:
String
)
{
// 埋点数据包装
val
jsonObject
=
JSONObject
()
jsonObject
.
put
(
"eventName"
,
"VIEW_WIDGET"
)
val
contextJsonObject
=
JSONObject
()
contextJsonObject
.
put
(
"page"
,
"ORDER_DETAIL_PAGE"
)
jsonObject
.
put
(
"contextMap"
,
contextJsonObject
)
val
entitiesJsonObject
=
JSONObject
()
val
widgetInfoJsonObject
=
JSONObject
()
widgetInfoJsonObject
.
put
(
"widget_type"
,
"BUTTON"
)
widgetInfoJsonObject
.
put
(
"widget_name"
,
widgetName
)
entitiesJsonObject
.
put
(
"widget_info"
,
widgetInfoJsonObject
)
jsonObject
.
put
(
"entitiesMap"
,
entitiesJsonObject
)
val
propertiesJsonObject
=
JSONObject
()
propertiesJsonObject
.
put
(
"event_id"
,
"SHQ_R_1625560990174"
)
propertiesJsonObject
.
put
(
"event_id"
,
"SHQNG_R_1632389997706"
)
jsonObject
.
put
(
"propertiesMap"
,
propertiesJsonObject
)
jsonObject
.
put
(
"logType"
,
1
)
CPointUtils
.
performCommitLog
(
jsonObject
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment