Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
zhwy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ffc88c09
authored
Jan 10, 2024
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新SOP埋点
1 parent
a42340c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
47 deletions
api/env/index.js
api/module/sopApi.js
app.js
utils/track/Track.js
api/env/index.js
View file @
ffc88c0
import
{
preReleaseAppId
}
from
'~/config'
import
{
preReleaseAppId
}
from
'~/config'
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'preRelease'
]
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'preRelease'
]
let
index
=
1
let
index
=
2
/**
/**
*
*
...
...
api/module/sopApi.js
View file @
ffc88c0
...
@@ -7,6 +7,7 @@ import {
...
@@ -7,6 +7,7 @@ import {
/**
/**
* sop客户埋点上报
* sop客户埋点上报
*/
*/
const
getDuration
=
page_show_time
=>
(
Date
.
now
()
-
page_show_time
)
/
1
e3
const
reportClick
=
({
const
reportClick
=
({
thisPage
,
thisPage
,
options
options
...
@@ -17,20 +18,10 @@ const reportClick = ({
...
@@ -17,20 +18,10 @@ const reportClick = ({
}
}
reportSopCustomer
(
thisPage
,
'PAGE_CLICK'
)
reportSopCustomer
(
thisPage
,
'PAGE_CLICK'
)
}
}
const
reportStop
=
({
thisPage
})
=>
{
thisPage
.
sopTimer
=
setInterval
(()
=>
{
reportSopCustomer
(
thisPage
,
'PAGE_STOP'
)
},
3
e3
)
}
const
reportHide
=
({
const
reportHide
=
({
thisPage
thisPage
})
=>
{
})
=>
{
if
(
thisPage
.
sopTimer
)
{
reportSopCustomer
(
thisPage
,
'PAGE_STOP'
)
clearInterval
(
thisPage
.
sopTimer
)
thisPage
.
sopTimer
=
null
}
}
}
const
reportSopCustomer
=
async
(
thisPage
,
event_type
)
=>
{
const
reportSopCustomer
=
async
(
thisPage
,
event_type
)
=>
{
const
{
const
{
...
@@ -42,20 +33,15 @@ const reportSopCustomer = async (thisPage, event_type) => {
...
@@ -42,20 +33,15 @@ const reportSopCustomer = async (thisPage, event_type) => {
if
(
options
&&
options
.
scene
)
{
if
(
options
&&
options
.
scene
)
{
const
data
=
await
getScene
(
options
.
scene
)
const
data
=
await
getScene
(
options
.
scene
)
thisPage
.
options
=
data
thisPage
.
options
=
data
reportSopFun
({
reportSopFun
(
thisPage
,
event_type
)
options
:
data
,
}
else
reportSopFun
(
thisPage
,
event_type
)
route
},
event_type
)
}
else
reportSopFun
({
options
,
route
},
event_type
)
}
}
}
}
const
reportSopFun
=
async
({
const
reportSopFun
=
async
(
thisPage
,
event_type
)
=>
{
options
,
const
{
route
options
,
},
event_type
)
=>
{
route
}
=
thisPage
if
(
!
options
.
sopId
)
return
if
(
!
options
.
sopId
)
return
const
userInfo
=
wx
.
p
.
storage
.
get
(
'userInfo'
)
||
{},
const
userInfo
=
wx
.
p
.
storage
.
get
(
'userInfo'
)
||
{},
pageType
=
sopTrackPageType
[
route
]
||
''
,
pageType
=
sopTrackPageType
[
route
]
||
''
,
...
@@ -63,28 +49,29 @@ const reportSopFun = async ({
...
@@ -63,28 +49,29 @@ const reportSopFun = async ({
merchantId
=
options
.
merchantId
||
''
,
merchantId
=
options
.
merchantId
||
''
,
unionId
=
userInfo
.
unionId
||
''
,
unionId
=
userInfo
.
unionId
||
''
,
sopId
=
options
.
sopId
||
''
,
sopId
=
options
.
sopId
||
''
,
extra
=
JSON
.
stringify
(
{
extra
=
{
pageType
,
pageType
,
activityId
,
activityId
,
unionId
,
unionId
,
merchantId
,
merchantId
,
sopId
}),
buryingPointList
=
[{
customer_phone
:
userInfo
.
phone
||
''
,
add_way
:
'SOP'
,
sopId
,
sopId
,
// id_number: '',
}
// org_user_id: '',
if
(
event_type
==
'PAGE_STOP'
)
extra
.
time
=
getDuration
(
thisPage
.
page_show_time
)
// wechat_id: '',
const
buryingPointList
=
[{
wechat_union_id
:
unionId
,
customer_phone
:
userInfo
.
phone
||
''
,
org_id
:
merchantId
,
add_way
:
'SOP'
,
system_source
:
'scrm'
,
sopId
,
platform
:
'MimiProgram'
,
// id_number: '',
event_type
,
// org_user_id: '',
event_time
:
new
Date
().
format
(
'yyyy-MM-dd hh:mm:ss'
),
// wechat_id: '',
extra
wechat_union_id
:
unionId
,
}]
org_id
:
merchantId
,
system_source
:
'scrm'
,
platform
:
'MimiProgram'
,
event_type
,
event_time
:
new
Date
().
format
(
'yyyy-MM-dd hh:mm:ss'
),
extra
:
JSON
.
stringify
(
extra
)
}]
api
.
post
({
api
.
post
({
method
:
'marketing.api.sop.buryingPoint'
,
method
:
'marketing.api.sop.buryingPoint'
,
projectName
:
'material'
,
projectName
:
'material'
,
...
@@ -93,7 +80,6 @@ const reportSopFun = async ({
...
@@ -93,7 +80,6 @@ const reportSopFun = async ({
}
}
module
.
exports
=
{
module
.
exports
=
{
reportSopCustomer
,
reportSopCustomer
,
reportStop
,
reportClick
,
reportClick
,
reportHide
reportHide
}
}
\ No newline at end of file
\ No newline at end of file
app.js
View file @
ffc88c0
...
@@ -26,9 +26,6 @@ App({
...
@@ -26,9 +26,6 @@ App({
router
,
router
,
storage
:
new
utils
.
cache
.
Storage
(),
storage
:
new
utils
.
cache
.
Storage
(),
$Track
:
new
TRACK
(
options
,
{
$Track
:
new
TRACK
(
options
,
{
onShowFun
:
[
api
.
sopApi
.
reportStop
],
onLoadFun
:
[
onLoadFun
:
[
api
.
sopApi
.
reportClick
api
.
sopApi
.
reportClick
],
],
...
...
utils/track/Track.js
View file @
ffc88c0
...
@@ -56,7 +56,7 @@ class TRACK {
...
@@ -56,7 +56,7 @@ class TRACK {
thisPage
:
this
thisPage
:
this
},
'onShowFun'
)
},
'onShowFun'
)
onShow
&&
onShow
.
apply
(
this
,
arguments
)
onShow
&&
onShow
.
apply
(
this
,
arguments
)
//
, (_this.getPageInstance().page_show_time = Date.now())
,
(
_this
.
getPageInstance
().
page_show_time
=
Date
.
now
())
}
}
thisPage
.
onHide
=
function
()
{
thisPage
.
onHide
=
function
()
{
_this
.
customPageFun
({
_this
.
customPageFun
({
...
@@ -72,6 +72,9 @@ class TRACK {
...
@@ -72,6 +72,9 @@ class TRACK {
// )
// )
}
}
thisPage
.
onUnload
=
function
()
{
thisPage
.
onUnload
=
function
()
{
_this
.
customPageFun
({
thisPage
:
this
},
'onHideFun'
)
// let { page_show_time } = _this.getPageInstance()
// let { page_show_time } = _this.getPageInstance()
onUnload
&&
onUnload
.
apply
(
this
,
arguments
)
onUnload
&&
onUnload
.
apply
(
this
,
arguments
)
// ,_this.setTrack(
// ,_this.setTrack(
...
@@ -228,7 +231,7 @@ class TRACK {
...
@@ -228,7 +231,7 @@ class TRACK {
/**在全局埋点onShow增加自定义埋点事件 */
/**在全局埋点onShow增加自定义埋点事件 */
customPageFun
(
options
,
name
)
{
customPageFun
(
options
,
name
)
{
this
.
_customObject
[
name
].
map
(
e
=>
{
this
.
_customObject
[
name
]
?
.
map
(
e
=>
{
e
&&
e
(
options
)
e
&&
e
(
options
)
})
})
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment