-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: dau * refactor: start and stop record * chore: lint * chore: browser compatible * refactor: goldlog * refactor: clear data for project && page record * chore: lint * refactor: rebase * refactor: rebase * fix: glodlog create-project * feat: update version and changelog * refactor: new field for 3.0 dau and record version * chore: lint * fix: typo * fix: send dau after render
- Loading branch information
Showing
13 changed files
with
168 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,7 +246,7 @@ const BuildPageModal = ({ | |
} catch (error) { | ||
showMessage(error); | ||
} | ||
|
||
setSaveModal(false); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import axios from 'axios'; | ||
import dateTime from 'date-time'; | ||
import browser from 'browser-detect'; | ||
import logger from '@utils/logger'; | ||
import appConfig from '../appConfig'; | ||
|
||
const UA = browser(); | ||
|
||
function dau(data = {}) { | ||
logger.info('log dau'); | ||
|
||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
data.visit_time = dateTime(); | ||
data.UA = UA; | ||
|
||
return axios({ | ||
method: 'post', | ||
url: `${appConfig.apiUrl}goldlog/dau`, | ||
data, | ||
}); | ||
} | ||
|
||
let hidden; | ||
let visibilityChange; | ||
if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support | ||
hidden = 'hidden'; | ||
visibilityChange = 'visibilitychange'; | ||
} else if (typeof document.msHidden !== 'undefined') { | ||
hidden = 'msHidden'; | ||
visibilityChange = 'msvisibilitychange'; | ||
} else if (typeof document.webkitHidden !== 'undefined') { | ||
hidden = 'webkitHidden'; | ||
visibilityChange = 'webkitvisibilitychange'; | ||
} | ||
|
||
function handleVisibilityChange() { | ||
if (!document[hidden]) { | ||
dau(); | ||
} | ||
} | ||
|
||
export default function() { | ||
dau(); | ||
|
||
if (typeof document.addEventListener !== 'undefined') { | ||
document.addEventListener(visibilityChange, handleVisibilityChange, false); | ||
} | ||
|
||
if (typeof window.addEventListener !== 'undefined') { | ||
window.addEventListener('focus', handleVisibilityChange); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as request from 'request-promise-native'; | ||
|
||
export default async function(data) { | ||
try { | ||
const dataKeyArray = Object.keys(data); | ||
const gokey = dataKeyArray.reduce((finalStr, currentKey, index) => { | ||
const currentData = | ||
typeof data[currentKey] === 'string' | ||
? data[currentKey] | ||
: JSON.stringify(data[currentKey]); | ||
return `${finalStr}${currentKey}=${currentData}${ | ||
dataKeyArray.length - 1 === index ? '' : '&' | ||
}`; | ||
}, ''); | ||
|
||
console.log('glodlog:', gokey); | ||
|
||
await request({ | ||
method: 'post', | ||
url: 'http://gm.mmstat.com/iceteam.iceworks.log3', | ||
json: true, | ||
body: { | ||
cache: Math.random(), | ||
gmkey: 'CLK', | ||
gokey: encodeURIComponent(gokey), | ||
logtype: '2', | ||
}, | ||
}); | ||
} catch (error) { | ||
error.name = 'goldlog-error'; | ||
console.error(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters