gpt4 book ai didi

google-analytics - 如何向谷歌分析 View 添加过滤器?

转载 作者:行者123 更新时间:2023-12-03 10:07:26 28 4
gpt4 key购买 nike

好的,所以我正在尝试以编程方式将过滤器添加到谷歌分析 View 。谷歌指南推出:

https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/filters/insert#examples

该指南向您展示了如何插入过滤器。但是此过滤器是在帐户级别创建的,然后您需要将其添加到特定 View 中。如何将其添加到 View 中?

最佳答案

您需要创建一个 profile filter link :

# Note: This code assumes you have an authorized Analytics service object.
# See the Filters Developer Guide for details.

# This request creates a new profile filter link.
try:
analytics.management().profileFilterLinks().insert(
accountId='123456',
webPropertyId='UA-123456-1',
profileId='7654321',
body={
'filterRef': {
'id': '1223334444'
}
}
).execute()

except TypeError, error:
# Handle errors in constructing a query.
print 'There was an error in constructing your query : %s' % error

except HttpError, error:
# Handle API errors.
print ('There was an API error : %s : %s' %
(error.resp.status, error.resp.reason))

关于google-analytics - 如何向谷歌分析 View 添加过滤器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29311518/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com