Method: properties.dataStreams.getGlobalSiteTag
返回指定网站数据流的网站代码。网站代码是不可变的单例。
HTTP 请求
GET https://analyticsadmin.googleapis.com/v1alpha/{name=properties/*/dataStreams/*/globalSiteTag}
网址采用 gRPC 转码语法。
路径参数
参数 |
name |
string
必需。要查询的网站代码的名称。请注意,网站代码是单例代码,没有唯一 ID。格式:property/{property_id}/dataStreams/{stream_id}/globalSiteTag 示例:properties/123/dataStreams/456/globalSiteTag
|
响应正文
只读资源,带有用于将数据从网站发送到 DataStream 的标记。仅适用于网站 DataStream 资源。
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"name": string,
"snippet": string
} |
字段 |
name |
string
仅限输出。此 GlobalSiteTag 资源的资源名称。格式:property_id}/dataStreams/{stream_id}/globalSiteTag 示例:“properties/123/dataStreams/456/globalSiteTag”
|
snippet |
string
不可变。将作为第一项的 JavaScript 代码段粘贴到要衡量的每个网页的 head 标记中。
|
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/analytics.readonly
https://www.googleapis.com/auth/analytics.edit
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-22。
[null,null,["最后更新时间 (UTC):2024-08-22。"],[[["Retrieves the Site Tag, an immutable singleton, associated with a specific web stream."],["Utilizes an HTTP GET request with the format `GET https://analyticsadmin.googleapis.com/v1alpha/{name=properties/*/dataStreams/*/globalSiteTag}` to fetch the tag."],["Requires providing the web stream's name using the path parameter `name` in the format `properties/{property_id}/dataStreams/{stream_id}/globalSiteTag`."],["Returns a JSON response containing the site tag's name and the JavaScript snippet for website implementation."],["Needs authorization with either `https://www.googleapis.com/auth/analytics.readonly` or `https://www.googleapis.com/auth/analytics.edit` scope."]]],["This outlines retrieving a web stream's Site Tag via a `GET` request to a specified URL. The required `name` parameter, formatted as `properties/{property_id}/dataStreams/{stream_id}/globalSiteTag`, identifies the Site Tag. The request body must be empty. The successful response, in JSON format, provides a `name` (resource identifier) and an immutable `snippet` (JavaScript code) for website data measurement. This can be achieved through authorization with either `analytics.readonly` or `analytics.edit` OAuth scopes.\n"]]