Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
gltracker
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 7944b64d
authored
Jul 08, 2022
by
杨北旺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改上报数据结构
1 parent
b49d6499
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
src/main.js
src/main.js
View file @
7944b64
...
@@ -7,11 +7,11 @@ const defaultData = {
...
@@ -7,11 +7,11 @@ const defaultData = {
server_url
:
'http://tracking-backend.test.glsx.com/track'
,
server_url
:
'http://tracking-backend.test.glsx.com/track'
,
send_timeout
:
6000
,
send_timeout
:
6000
,
max_length
:
10
,
max_length
:
10
,
show_log
:
tru
e
,
show_log
:
fals
e
,
switch
:
true
switch
:
true
}
}
const
commonData
=
{}
const
commonData
=
{}
function
init
({
settings
,
common
,
getTitle
})
{
function
init
({
settings
,
common
,
getTitle
})
{
initSetting
(
settings
)
initSetting
(
settings
)
setPublicProperties
(
common
)
setPublicProperties
(
common
)
util
.
getTitle
=
getTitle
util
.
getTitle
=
getTitle
...
@@ -62,17 +62,19 @@ window.history.replaceState = aop('replaceState'); // 更改路由,不会留
...
@@ -62,17 +62,19 @@ window.history.replaceState = aop('replaceState'); // 更改路由,不会留
// window.addEventListener('onload',()=>{
// window.addEventListener('onload',()=>{
// timeStr = new Date().getTime()
// timeStr = new Date().getTime()
// })
// })
window
.
addEventListener
(
'popstate'
,
()
=>
{
window
.
addEventListener
(
'popstate'
,
()
=>
{
let
curTime
=
util
.
dateFormat
(
new
Date
())
let
curTime
=
util
.
dateFormat
(
new
Date
())
let
intoTime
=
getStorageSync
(
'intoTime'
)
let
intoTime
=
getStorageSync
(
'intoTime'
)
let
pageUrl
=
getStorageSync
(
'pageUrl'
)
const
pageParam
=
{
const
pageParam
=
{
pageUrl
:
window
.
location
.
href
,
pageUrl
,
leaveTime
:
curTime
,
leaveTime
:
curTime
,
intoTime
,
intoTime
,
pageName
:
util
.
getTitle
()
pageName
:
util
.
getTitle
()
}
}
tracker
.
track
(
pageParam
,
'pv'
)
tracker
.
track
(
pageParam
,
'pv'
)
setStorageSync
(
'intoTime'
,
curTime
)
setStorageSync
(
'intoTime'
,
curTime
)
setStorageSync
(
'pageUrl'
,
window
.
location
.
href
)
})
})
// window.addEventListener('pushState', function() {
// window.addEventListener('pushState', function() {
// let t = new Date().getTime() - timeStr
// let t = new Date().getTime() - timeStr
...
@@ -171,16 +173,18 @@ const uploadStroageData = (params = {}, option) => {
...
@@ -171,16 +173,18 @@ const uploadStroageData = (params = {}, option) => {
// eslint-disable-next-line func-names
// eslint-disable-next-line func-names
kit
.
buildData
=
function
(
trackParam
)
{
kit
.
buildData
=
function
(
trackParam
)
{
const
data
=
{}
const
data
=
{}
const
temp
=
{
console
.
log
(
trackParam
);
event
:
trackParam
.
event
,
...
trackParam
.
properties
}
if
(
trackParam
.
event
==
'pv'
)
{
if
(
trackParam
.
event
==
'pv'
)
{
Object
.
assign
(
data
,
temp
)
Object
.
assign
(
data
,
trackParam
.
properties
,{
event
:
'pv'
}
)
}
else
{
}
else
{
temp
.
create_time
=
util
.
dateFormat
(
new
Date
())
const
obj
=
{
temp
.
pageUrl
=
window
.
location
.
href
pageUrl
:
window
.
location
.
href
,
data
.
exta
=
JSON
.
stringify
(
temp
)
intoTime
:
getStorageSync
(
'intoTime'
),
event
:
trackParam
.
event
,
pageName
:
trackParam
.
properties
.
pageName
}
data
.
exta
=
JSON
.
stringify
(
trackParam
.
properties
)
Object
.
assign
(
data
,
obj
)
}
}
Object
.
assign
(
data
,
commonData
)
Object
.
assign
(
data
,
commonData
)
return
data
return
data
...
...
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