测量协议
该文章记录了 GrowingIO SDK 上传时所有的字段及其参数意义。
所有事件携带的信息(context)
字段名称 | 数据类型 | 是否必有 | 解释说明 |
---|---|---|---|
platform | string | ✅ | 操作平台 1. Android; 2. iOS 3. Web |
platformVersion | string | ✅ | 操作系统版本 |
deviceId | string | ✅ | 设备ID(访问用户ID) |
userId | string | ❌ | 登录用户ID |
sessionId | string | ✅ | 访问会话ID |
eventType | string | ✅ | 事件类型:VISIT, CUSTOM, LOGIN_USER_ATTRIBUTES, APP_CLOSED, PAGE, VIEW_CLICK, VIEW_CHANGE, ACTIVATE |
timestamp | long | ✅ | 时间戳 |
domain | string | ✅ | APP包名或者H5页面的域名 |
urlScheme | string | ✅ | 链接协议 |
appState | string | ✅ | APP状态:1. FOREGROUND 前台运行 2. BACKGROUND 后台运行 |
eventSequenceId | long | ✅ | 事件请求编号 |
dataSourceId | string | ✅ | CDP特有,只有在cdp上面才是必须字段 |
gioId | string | ❌ | CDP特有,idMapping使用 |
networkState | string | ✅ | 网络类型:2G,3G,4G,5G,WIFI,UNKNOWN |
appChannel | string | ❌ | 应用渠道(Android 特有) |
screenHeight | int | ✅ | 屏幕高度 |
screenWidth | int | ✅ | 屏幕宽度 |
deviceBrand | string | ✅ | 设备品牌 |
deviceModel | string | ✅ | 设备型号 |
deviceType | string | ✅ | 设备类型:PHONE,PAD,… |
appVersion | string | ✅ | APP版本,用户配置 |
appName | string | ✅ | APP名称 |
language | string | ✅ | 语言, ISO 639标准 Android:ISO 639 alpha-2 or alpha-3 iOS:ISO 639-1 code if available, or the ISO 639-2 code if not > ISO 639 不是一个稳定的标准 |
latitude | double | ❌ | 纬度 |
longitude | double | ❌ | 经度 |
sdkVersion | string | ✅ | SDK 版本号 |
userKey | string | ❌ | 登录用户ID的类型(用户自定义) |
timezoneOffset | string | ✅ | 时区偏移 |
operatingSystem | string | ❌ | 小程序必有,系统类型 |
访问事件(VISIT)
- 请求发送时机:每当产生一个新的访问时
- 请求Body
字段名称 | 数据类型 | 是否必有 | 解释说明 |
---|---|---|---|
imei | string | ❌ | IMEI(Android 特有) |
androidId | string | ❌ | AndroidId(Android 特有) |
oaid | string | ❌ | 国内的广告ID(Android 特有) |
googleAdvertisingId | string | ❌ | google广告ID(Android 特有) |
idfa | string | ❌ | iOS广告标识符(iOS 特有) |
idfv | string | ❌ | iOS应用开发商标识符(iOS 特有) |
extraSdk | Map<string, string> | ❌ | 额外的SDK信息 |
示例
{
"platform": "Android",
"platformVersion": "12",
"deviceId": "ef512d03-9912-377f-8e6e-2bc27c9c6b9b",
"sessionId": "351b2e50-1be9-4b17-b899-49445f305ec6",
"eventType": "VISIT",
"timestamp": 1692911673474,
"domain": "com.growingio.myapplication",
"urlScheme": "growing.12345678",
"appState": "BACKGROUND",
"eventSequenceId": 1,
"dataSourceId": "12345678",
"networkState": "WIFI",
"screenHeight": 2160,
"screenWidth": 1080,
"deviceBrand": "google",
"deviceModel": "sdk_gphone64_arm64",
"deviceType": "PHONE",
"appName": "My Application",
"appVersion": "1.0",
"language": "zh",
"sdkVersion": "4.0.0-SNAPSHOT",
"timezoneOffset": "-480",
"androidId": "c71972f5ace2b4f9"
}
埋点事件(CUSTOM)
- 请求发送时机:当用户主动调用track类型的接口时,半自动埋点,自主业务采集
- 请求Body
字段名称 | 数据类型 | 是否必有 | 解释说明 |
---|---|---|---|
eventName | string | ✅ | 埋点事件的标识符 |
path | string | ❌ | 埋点事件关联的page |
pageShowTimestamp | long | ❌ | 埋点事件关联的page的显示时间戳 |
attributes | Map<string, string> | ❌ | 埋点事件属性 |
query | string | ❌ | Hybrid页面url 中的query |
resourceItem | 对象 ResourceItem | ❌ | 物品模型(CDP 特有) |
ResourceItem
字段名称 | 数据类型 | 是否必有 | 解释说明 |
---|---|---|---|
id | string | ✅ | 物品模型id |
key | string | ✅ | 物品模型key |
attributes | Map<string, string> | ❌ | 物品模型属性 |
示例
{
"platform": "Android",
"platformVersion": "12",
"deviceId": "ef512d03-9912-377f-8e6e-2bc27c9c6b9b",
"sessionId": "80210d54-66d1-42a5-beff-595985bfede3",
"eventType": "CUSTOM",
"timestamp": 1692911996960,
"domain": "com.growingio.myapplication",
"urlScheme": "growing.12345678",
"appState": "FOREGROUND",
"eventSequenceId": 2,
"dataSourceId": "12345678",
"networkState": "WIFI",
"screenHeight": 2160,
"screenWidth": 1080,
"deviceBrand": "google",
"deviceModel": "sdk_gphone64_arm64",
"deviceType": "PHONE",
"appName": "My Application",
"appVersion": "1.0",
"language": "zh",
"sdkVersion": "4.0.0-SNAPSHOT",
"timezoneOffset": "-480",
"attributes": {
"goods": "Shoe",
"brand": "Nick"
},
"eventName": "pay"
}
用户属性事件(LOGIN_USER_ATTRIBUTES)
- 请求发送时机:当用户主动调用track类型的接口时
- 请求Body
字段名称 | 数据类型 | 是否必有 | 解释说明 |
---|---|---|---|
attributes | Map<string, string> | ✅ | 登录用户属性 |
示例
{
"platform": "Android",
"platformVersion": "12",
"deviceId": "ef512d03-9912-377f-8e6e-2bc27c9c6b9b",
"sessionId": "da55d848-82ff-4a46-94df-b005589c18ae",
"eventType": "LOGIN_USER_ATTRIBUTES",
"timestamp": 1692912458904,
"domain": "com.growingio.myapplication",
"urlScheme": "growing.12345678",
"appState": "FOREGROUND",
"eventSequenceId": 0,
"dataSourceId": "12345678",
"networkState": "WIFI",
"screenHeight": 2160,
"screenWidth": 1080,
"deviceBrand": "google",
"deviceModel": "sdk_gphone64_arm64",
"deviceType": "PHONE",
"appName": "My Application",
"appVersion": "1.0",
"language": "zh",
"sdkVersion": "4.0.0-SNAPSHOT",
"timezoneOffset": "-480",
"attributes": {
"vipLevel": "10",
"email": "xxx@growingio.com"
}
}