使用客户端 ID 获取用户信息 [英] Getting user info using Client ID

查看:30
本文介绍了使用客户端 ID 获取用户信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 analytics.js 跟踪脚本插入到我的代码中,现在我正在尝试使用 javascript 获取用户数据,例如媒体、来源等,并将它们放入变量中.有没有办法使用客户端 ID 来做到这一点?

I have inserted the analytics.js tracking script into my code, and now I am trying to get user data such as medium, source, etc. using javascript and putting them into variables. Is there a way I can do this using Client Id?

推荐答案

我假设您的意思是实时获取数据以在您的网站中使用.这是不可能的.

I assume you mean getting the data in realtime for use in your website. That is not possible.

默认情况下,客户端 ID 不会在界面中公开,您需要使用自定义维度.

Client ID is not exposed in the interface by default, you'd need to use a custom dimension.

有一个处理延迟,报告数据可能只有第二天才能可靠.

There is a processing delay, report data may only be reliable the next day.

虽然有来自实时 API 的(不太可靠的)数据(至少包含媒体和来源信息),但它不支持自定义维度,因此您不能使用客户端 ID 作为查询键.

While there is the (less reliable) data from the real time API (which at least contains medium and source information) it does not support custom dimension, so you could not use the client id as query key.

此外,要从 API 检索数据,您需要进行身份验证,而您网页的当前用户则不需要.因此,您需要设置某种服务器端代理来为您处理身份验证.

Also to retrieve data from the API you need to be authenticated, which the current users of your webpage is not. So you would need to set up some kind of serverside proxy that handles authentication for you.

此外,API 限制决定了您在给定时间范围内可以发出的请求数.即使是小型站点也会很快耗尽这些请求.

Also there are API limits determining how many requests you can make in a given time frame. Even a small site would exhaust those requests pretty quickly.

因此,虽然理论上这听起来可行,但实际上对于任何现实生活目的都不可行.

So while in theory this sounds doable it is not actually feasible for any real-life purpose.

这篇关于使用客户端 ID 获取用户信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆