@esri/telemetry
这是ArcGIS-Teleometry.js的"核心"包. 有必要向谷歌,Adobe,AWS等分析平台发送数据.
目录
安装
npm install @esri/telemetry
使用量
术语
Telemetry:用于使用信号的供应商不可知收集和路由接口.Plugin: 文档和表格中使用的外向整合术语plugins配置阵列 .Tracker:核心运行时间所使用的内部代码级演员/界面.Analytics:下游目的地/报告系统(如AWS,Google,Adobe,Siteimprove等).
隐私追踪
从7.x版本开始, telemetry.js 支持隐私追踪同意。 主机应用程序可以决定允许此行为通过 .requireConsent 以及可选选项 IPrivacySettings 对象。 下面的例子表明了这一结构.
用户可以同意以下类型的"跟踪": 1
- 性能: 只允许发送和存储应用程序性能信息
- 功能: 允许存储功能信息, 如透视、 过去搜索等
- 目标:允许用户发送目标信息
何时 requireConsent 被通过,没有 userPrivacySettings 发送, telemetry.js 操作时似乎用户选择了退出所有跟踪。 根据GDPR,这是预期的行为.
何时 userPrivacySettings.performance: true,并配置了 Amazon 插件,将初始化.
对于Hub Sites(和一些其他的平台应用),客户可以配置额外的第3方跟踪系统(Google Analytics,Adobe,SiteImprove).
为使这些跟踪器启用,最终用户必须选择使用 performance, (中文(简体) ), functional 财务报告和审定财务报表 targeting因为我们不知道 或控制 3 党跟踪者在做什么, 所以我们必须假设 他们 跟踪所有 三个.
在浏览器中
import { Telemetry } from '@esri/telemetry';
// create options object
const opts = {
requireConsent: true, // if your app requires privacy consent, set this to true
plugins: [list of vendor plugins goes in here]
};
// Host app should load user privacy settings from localStorage or cookies
const storedSettings = window.localStorage.getItem('esri_privacy_settings');
if (storedSettings) {
opts.userPrivacySettings = JSON.parse(storedSettings);
} else {
// this is optional, as telemetry.js will construct the same thing
// if requiteConsent: true and not settings are passed in
opts.userPrivacySettings = {
id: '3ef...', // create some unique id
timestamp: Date.now(),
accepted: false, // user has not actually set these, so this is false
performance: false, // all set to false by default
functional: false,
targeting: false,
}
}
// create the telemetry instance
const telemetry = new Telemetry(opts);
await telemetry.init();
// now it is ready to go
在服务器中
由于这是在服务器上完成的,因此无法考虑用户隐私设置. 因此,在服务器上注入脚本标记是劝阻的,因为跟踪很可能在主机应用程序实际靴子之前开始,并且可以应用用户隐私设置.
import { Telemetry } from '@esri/telemetry';
// create options object
const opts = {
plugins: [list of vendor plugins goes in here]
};
// create the telemetry instance
const telemetry = new Telemetry(opts);
// in server
const scriptTags = telemetry.getScriptTags();
// now inject script tags into html page before sending it down
问题
如果有什么不起作用,请看一看 以往问题 先说 你找到新窃听器了吗? 创建问题 这里。 。 。 .
捐款
Esri欢迎所有人的贡献。 请看我们的 提交文件的准则。 。 。 .
许可证
版权: 2022 Esri
根据Apache许可证第2.0版("License"); 您不得使用此文件,除非符合许可证. 您可在下列地点获得许可证副本:
除非适用的法律要求或书面同意,否则软件 根据许可证发放的是在“AS IS”BASIS上发放的, 没有任何明示或暗示的警告或条件. 有关许可的特定语言的许可证 许可证的限制.
许可证副本可到存放处索取 自由主义 文档.