-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discus] 需要搜集的数据 #4
Comments
Rest APIPageView
Event
|
目前 if (document) {
data.domain = document.domain || '';
data.url = document.URL || '';
data.title = document.title || '';
data.referrer = document.referrer || '';
}
if (window && window.screen) {
data.sh = window.screen.height || 0;
data.sw = window.screen.width || 0;
data.scd = window.screen.colorDepth || 0;
}
if (navigator) {
data.lang = navigator.language || '';
data.cookieEnabled = navigator.cookieEnabled;
data.userAgent = navigator.userAgent;
data.platform = navigator.platform;
} 定义的事件类型接口: export interface EventDescriptor {
category?: 'global' | 'default' | string;
action: string;
userId?: string;
time?: number;
pageUrl?: string;
payload?: any;
} 调用方式示例: var _gaq = _gaq || [];
_gaq.push({
category: 'global',
action: 'pageView'
}); |
@hstarorg @Lession711 ga.setUid(uid:string); //设置uid
ga.pageView(data?:any); //记录当前页面基本信息。data参数可选,用于覆盖默认的记录值。
ga.track(action:string,payload:any); //若不设置category,则默认category为'default'。
ga.track(action:string,category:string,payload:any); 参考了神策数据的API,将trackEvent简化为了track。 发送给后台的数据结构如下: export interface EventDescriptor {
/** category */
c: 'global' | 'default' | string;
/** action */
a: string;
/** uid */
uid?: string;
/** time */
t: number;
/** page url */
url: string;
/** payload */
d?: any;
} 与@Lession711 定义的接口也些许不同。
一个示例请求如下:
|
@watermoonlx 建议把category做为第三个参数,并设置默认值,这样,api如下: |
另外,更建议使用 |
category放在第三个参数感觉不太好欸,它毕竟和action关联更近。 |
@watermoonlx 可选参数放最后。类似重载的感觉。 |
客户端收集
基础浏览器数据
${screen.width}*${screen.height}
页面加载性能数据
服务端收集
请求数据
API定义
The text was updated successfully, but these errors were encountered: