Skip to main content

测量协议


该文章记录了 GrowingIO SDK 上传时所有的字段及其参数意义。

所有事件携带的信息(context)

字段名称数据类型是否必有解释说明
platformstring操作平台
1. Android;
2. iOS
3. Web
platformVersionstring操作系统版本
deviceIdstring设备ID(访问用户ID)
userIdstring登录用户ID
sessionIdstring访问会话ID
eventTypestring事件类型:VISIT
CUSTOM
LOGIN_USER_ATTRIBUTES
APP_CLOSED
PAGE
VIEW_CLICK
VIEW_CHANGE
ACTIVATE
timestamplong时间戳
domainstringAPP包名或者H5页面的域名
urlSchemestring链接协议
appStatestringAPP状态:1. FOREGROUND 前台运行
2. BACKGROUND 后台运行
eventSequenceIdlong事件请求编号
dataSourceIdstringCDP特有,只有在cdp上面才是必须字段
gioIdstringCDP特有,idMapping使用
networkStatestring网络类型:2G,3G,4G,5G,WIFI,UNKNOWN
appChannelstring应用渠道(Android 特有)
screenHeightint屏幕高度
screenWidthint屏幕宽度
deviceBrandstring设备品牌
deviceModelstring设备型号
deviceTypestring设备类型:PHONE,PAD,…
appVersionstringAPP版本,用户配置
appNamestringAPP名称
languagestring语言, 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 不是一个稳定的标准
latitudedouble纬度
longitudedouble经度
sdkVersionstringSDK 版本号
userKeystring登录用户ID的类型(用户自定义)
timezoneOffsetstring时区偏移
operatingSystemstring小程序必有,系统类型

访问事件(VISIT)

  • 请求发送时机:每当产生一个新的访问时
  • 请求Body
字段名称数据类型是否必有解释说明
imeistringIMEI(Android 特有)
androidIdstringAndroidId(Android 特有)
oaidstring国内的广告ID(Android 特有)
googleAdvertisingIdstringgoogle广告ID(Android 特有)
idfastringiOS广告标识符(iOS 特有)
idfvstringiOS应用开发商标识符(iOS 特有)
extraSdkMap<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
字段名称数据类型是否必有解释说明
eventNamestring埋点事件的标识符
pathstring埋点事件关联的page
pageShowTimestamplong埋点事件关联的page的显示时间戳
attributesMap<string, string>埋点事件属性
querystringHybrid页面url 中的query
resourceItem对象 ResourceItem物品模型(CDP 特有)

ResourceItem

字段名称数据类型是否必有解释说明
idstring物品模型id
keystring物品模型key
attributesMap<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
字段名称数据类型是否必有解释说明
attributesMap<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"
}
}

APP、小程序关闭事件(APP_CLOSED)

  • 请求发送时机:当用户关闭APP时,立刻发送

  • 请求Body

字段名称数据类型是否必有解释说明

示例

{
"platform": "Android",
"platformVersion": "12",
"deviceId": "ef512d03-9912-377f-8e6e-2bc27c9c6b9b",
"sessionId": "da55d848-82ff-4a46-94df-b005589c18ae",
"eventType": "APP_CLOSED",
"timestamp": 1692912530812,
"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"
}

页面浏览事件(PAGE)

  • 请求发送时机:当用户打开一个页面时
  • 请求Body
字段名称数据类型是否必有解释说明
pathstring页面名
orientationstring屏幕显示方向:
PORTRAIT 竖向
LANDSCAPE 横向
titlestring页面标题
referralPagestring来源页面
querystringHybrid页面url 中的query
protocolTypestringHybrid页面url 中的协议头,如https
attributesMap<string, string>页面属性

示例

{
"platform": "Android",
"platformVersion": "12",
"deviceId": "ef512d03-9912-377f-8e6e-2bc27c9c6b9b",
"sessionId": "b64dbce1-fbae-497e-b6fe-be3a69ae289c",
"eventType": "PAGE",
"timestamp": 1692912241647,
"domain": "com.growingio.myapplication",
"urlScheme": "growing.12345678",
"appState": "FOREGROUND",
"eventSequenceId": 5,
"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": {
"pageName": "MainPage"
},
"path": "/Main",
"orientation": "PORTRAIT",
"title": "My Application",
"referralPage": ""
}

元素点击事件(VIEW_CLICK)

  • 请求发送时机:当用户点击页面元素的时候
  • 请求Body
字段名称数据类型是否必有解释说明
pathstring元素所属页面名
pageShowTimestamplong页面显示时间
textValuestring元素文本内容
xpathstring元素骨架
xcontentstring元素样式/元素位置组
indexint列表元素序号
hyperlinkstringHybrid页面元素的href
querystringHybrid页面url 中的query

示例

{
"platform": "Android",
"platformVersion": "12",
"deviceId": "ef512d03-9912-377f-8e6e-2bc27c9c6b9b",
"sessionId": "c4462783-9bd9-4b05-8775-31f8125a8599",
"eventType": "VIEW_CLICK",
"timestamp": 1692912568659,
"domain": "com.growingio.myapplication",
"urlScheme": "growing.12345678",
"appState": "FOREGROUND",
"eventSequenceId": 10,
"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",
"path": "",
"textValue": "显示悬浮窗",
"xpath": "/MainActivity/DecorView/LinearLayout/FrameLayout/ActionBarOverlayLayout/ContentFrameLayout/LinearLayout/AppCompatTextView",
"index": -1,
"xcontent": "/0/0/0/0/decor_content_parent/0/0/tv1"
}

输入框改变内容事件(VIEW_CHANGE)

  • 请求发送时机:当用户对App上的输入元素有改变的行为时
  • 请求Body
字段名称数据类型是否必有解释说明
pathstring元素所属页面名
pageShowTimestamplong页面显示时间
textValuestring元素文本内容
xpathstringxpath标识符
indexint列表元素序号
hyperlinkstringHybrid页面元素的href
querystringHybrid页面url 中的query

示例

{
"platform": "Android",
"platformVersion": "12",
"deviceId": "ef512d03-9912-377f-8e6e-2bc27c9c6b9b",
"sessionId": "a911d86e-200d-43be-942c-4899b9ff6aed",
"eventType": "VIEW_CHANGE",
"timestamp": 1692912805657,
"domain": "com.growingio.myapplication",
"urlScheme": "growing.12345678",
"appState": "FOREGROUND",
"eventSequenceId": 14,
"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",
"path": "",
"textValue": "张三",
"xpath": "/MainActivity/DecorView/LinearLayout/FrameLayout/ActionBarOverlayLayout/ContentFrameLayout/LinearLayout/AppCompatEditText",
"index": -1,
"xcontent": "/0/0/0/0/decor_content_parent/0/0/et"
}

激活事件(ACTIVATE)

  • 请求发送时机:当 App 首次激活打开时
  • 请求Body
字段名称数据类型是否必有解释说明
attributesMap<string, string>激活相关属性
imeistringIMEI(Android 特有)
androidIdstringAndroidId(Android 特有)
oaidstring国内的广告ID(Android 特有)
googleAdvertisingIdstringgoogle广告ID(Android 特有)
idfastringiOS广告标识符(iOS 特有)
idfvstringiOS应用开发商标识符(iOS 特有)

示例

{
"platform": "Android",
"platformVersion": "12",
"deviceId": "ef512d03-9912-377f-8e6e-2bc27c9c6b9b",
"sessionId": "58ef553b-9c60-4b48-8e8b-60b2b085077c",
"eventType": "ACTIVATE",
"timestamp": 1692912871447,
"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": {
"userAgent": "Dalvik/2.1.0 (Linux; U; Android 12; sdk_gphone64_arm64 Build/SE1A.211012.001)"
},
"eventName": "$app_activation",
"androidId": "c71972f5ace2b4f9"
}