页面全局能力

线索双发

使用方式

顾名思义,线索双发指当开发者在页面中使用<aip-form>通用表单组件时,经过字节域内的创建流程后,用户在提交表单时,会将表单线索并行提交一份给青鸟线索通,便于提供线索通相关服务。

该能力默认关闭,在<head>标签内写入 <meta name="enableClue" content="true"> 即可开启。

TIP

若启用线索双发能力,则涉及收集线索的aip-input组件内需要按需指定clue-type字段标识出输入项的线索类型方可正常在表单提交时将线索正常上报至线索通-飞鱼链路。

页面洞察数据获取

使用方式

<head>标签内写入 <meta name="insight" content="服务器回调地址"> 即可,当页面展示的时候,会把相关的 PV,UV,页面性能等指标数据发送到服务器回调地址上。

<!doctype html>
<html aip>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <meta name="insight" content="https://www.log.com/insight">
    <script async src="运行时地址"></script>
    <!-- 引入其他 AIP 组件 -->
    <style aip-custom>
    /* 增加你的自定义样式 */
    </style>
    <title>My AIP Page</title>
  </head>
  <body>
    <aip-text>Hello World</aip-text>
  </body>
</html>





 











1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

页面洞察数据格式

向目标地址发送 POST 请求,内容如下:

{
  trackData: {
    type: TrackType,
    event: TrackEvent,
    properties: TrackProperties,
    sessionId: string,
    pageviewId: string,
    timestamp: number,
    adinfo: AdInfo,
    pageId: string
  }
}
1
2
3
4
5
6
7
8
9
10
11
12

类型说明

enum TrackType {
    PAGE = 'page',
    TRACK = 'track',
}

enum TrackEvent {
    CLICK = 'click',
    PAGE = 'page',
    METRICS = 'metrics',
    RECORD = 'record'
}

type MetricsProperties = {
  load: number
}

type PageProperties = {
  path: '',
  referrer: '',
  search: '',
  hash: '',
  title: string,
  url: string
}

enum RecordType {
    SCROLL = 'scroll',
    CLICK = 'click'
}

type ScrollEvent = {
    type: RecordType.SCROLL
    x: number
    y: number
    width: number
    height: number
    target: string
    time: number
}

type ClickEvent = {
    type: RecordType.CLICK
    x: number
    y: number
    cx: number
    cy: number
    px: number
    py: number
    width: number
    height: number
    target: string
    brickIndex: string
    time: number
}

type RecordTrackEvent = ScrollEvent | ClickEvent

type RecordProperties = {
  context: {
     deviceInfo: {
        viewpointWidth: number,
        viewpointHeight: number,
    },
    initTimestamp: number,
    timestamp: number
  },
  events: RecordTrackEvent[]
}

type TrackProperties = MetricsProperties | PageProperties | RecordProperties | PlainObject

type AdInfo {
    aid?: string;
    cid?: string;
    click_id?: string;
    req_id?: string;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Last Updated: 2022/7/15 下午7:22:06