如何从跟踪代码获取谷歌个人资料ID?
我正在使用 Google API 获取 Google 分析。为了获得分析,我需要提供类似于“ga:12345678”的配置文件 ID。
问题是用户可以拥有多个配置文件。是否可以从 Google 跟踪代码中找出个人资料 ID(例如,如果我知道类似于“UA-1234567-1”的跟踪 ID)? 它们之间有联系吗?
谢谢
I'm getting Google analytics using Google API. In order to get analytics I need to provide profile Id which looks like "ga:12345678".
The problem is that user can have many profiles. Is it possible to figure out profile Id from say Google tracking code (e.g. if I know tracking ID which looks like "UA-1234567-1")?
Are they related to each other at all?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我遇到了同样的问题,我找到了获取谷歌分析配置文件 ID 的最简单方法。
登录 Google Analytics(分析)
1.访问您网站的个人资料(进入仪表板)
2.您的 URL 应如下所示:
/a1234b23478970p987654/
最后一部分,“p”之后是您的 Google Analytics 配置文件 ID,在本例中(这是一个虚假帐户)为“987654”
I had the same issue and I find out the simplest way to get google analytics profile id.
Log into Google Analytics
1.Access your site’s profile (get to the dashboard)
2.Your URL should look like:
/a1234b23478970p987654/
That last part, after the “p” is your Google Analytics Profile ID, in this case (this is a fake account) it is “987654”
您可以使用管理 API(下面的链接)以编程方式获取给定 WebPropertyId(UA 代码)存在的配置文件。
您进行的 HTTP 调用将如下所示:
其中
accountID
和webPropertyID
将设置为您感兴趣的特定值或~all
恢复当前用户有权访问的所有内容。如果按照惯例,您没有在 Web 属性下创建多个配置文件,则只会为给定的 WebPropertyId 返回默认配置文件,这意味着您将获得从 WebPropertyId 到配置文件 ID 的一对一映射。这将允许您从 WebPropertyId 查找配置文件 ID。
有关详细信息,请参阅此处的管理 API 文档:http://code。 google.com/apis/analytics/docs/mgmt/mgmtFeedReference.html
You can programatically get the profiles that exist for a given WebPropertyId (UA code) using the management API (link below).
The HTTP call you make will look like this:
Where
accountID
andwebPropertyID
will either be set to the specific values you are interested in or~all
to bring back everything the current user has access to.If by convention you don't create multiple profiles under a Web Property then only the default profile will be returned for a given WebPropertyId, which means you will be getting a one-to-one mapping from WebPropertyId to profile id. This will allow you to look up a profile id from a WebPropertyId.
See here on the management API docs for more info: http://code.google.com/apis/analytics/docs/mgmt/mgmtFeedReference.html
我刚刚完成了通过 Java 中的跟踪代码查找配置文件 ID 的任务。关键是跟踪代码用作网络资源 ID,并且配置文件通过内部网络资源 ID 与网络资源链接。步骤如下:
完整代码如下, getProfileId() 方法将返回您想要的配置文件 id:
I had just done this task of finding the profile ID by Tracking Code in Java. The key is that tracking code is used as web property Id and the profile is linked with web property through an internal web property id. So the steps are as below:
The full code is as follows, the getProfileId() method will return the profile id you want:
您尝试获取的内容称为
tableId
。跟踪代码中使用的 ID 称为webPropertyId
。可以为每个网络媒体资源创建多个具有唯一tableId
的配置文件。您可以从 GA 中的“分析设置 > 配置文件设置”屏幕获取
tableId
(在配置文件之一上按“编辑”)。然后获取“个人资料 ID”字段并将其附加到“ga:”。您还可以使用帐户 Feed 下载帐户详细信息,包括个人资料数据:http://code.google.com/intl/en/apis/analytics/docs/gdata/gdataReferenceAccountFeed.htmlWhat you're trying to obtain is called the
tableId
. The ID used in tracking code is called thewebPropertyId
. It's possible to create multiple profiles, with uniquetableId's
, for each web property.You can get the
tableId
from the "Analytics Settings > Profile Settings" screen within GA (press 'edit' on one of the profiles). Then take the "Profile ID" field and append it to "ga:". You can also download the account details, including profile data, using the Account Feed: http://code.google.com/intl/en/apis/analytics/docs/gdata/gdataReferenceAccountFeed.html我使用
Perl
完成此操作。这是
获取请求
的网址
使用此
url
和Token
来生成数据,您可以在其中找到ga id
希望这会有所帮助。
I done this using
Perl
.This is the url to
get request
use this
url
withToken
to generate Data where you will find thega id
Hope this helps.