有没有办法批量配置文件 (ViewID) 更新查询?

Is there a way to batch profile (ViewID) update queries?

我正在努力使我们机构的分析符合最佳实践,这将需要批量更新、创建和修改多个分析视图 ID。

我不必手动更新分析中的每个视图,而是能够通过 google 分析的管理 api 更新相当数量的视图。

我 运行 遇到的问题是写入配额限制设置为每天 50 次,按照这个速度,光是更新 viewid 就需要 27 天,谁知道要花多长时间呢我需要做的其他事情。

对于这个特殊问题,我已经进行了个别查询以更新我拥有的 viewid,但 rapidly 达到了每日写入配额。

我目前正在使用 google api 库中的 BatchHttpRequest 对我的查询进行批处理,但查询恰好很快而且它似乎并没有真正减少查询的数量发生。

https://googleapis.github.io/google-api-python-client/docs/epy/googleapiclient.http.BatchHttpRequest-class.html

我正在尝试这条路线,因为这是在管理用户时减少查询的推荐方法,我希望我能看到类似的数据性能提升。

https://developers.google.com/analytics/devguides/config/mgmt/v3/user-management#batching

batch = BatchHttpRequest(callback=call_back)

    #for every item in list put together update query
    for i in range(1, max_row+1):

        link = service.management().profiles().update(
            accountId=accountid,
            webPropertyId=propertyid,
            profileId=viewid,
            body={
                'name': 'Master View',
                'eCommerceTracking': True,
                'enhancedECommerceTracking': True,
                'currency': 'USD',
                'timezone': 'America/New_York',
                'websiteUrl': updatesite
            }
        )

        #Add query to batch httpquery
        batch.add(link)

        #keep track of what's been added to the batch
        print('adding ' + updatesite +
                ' to batch request for ' + propertyname)

    #verify the batch object and execute
    print(batch)

    batch.execute(http=None)

预期:在尽可能少的查询中更新 Analytics 配置文件

结果:

请求 6 返回 API 错误:403:配额错误:超出写入速率限制。

然后

请求 12 返回 API 错误:403:配额错误:超出用户速率限制。

然后

请求 1 返回 API 错误:403 配额错误:配额错误:您已超出此项目的最大数量 writes/day。

所以在与脚本进行了大量的斗争之后,批处理不是每天将超过 50 个调用数据插入到分析中的选项。

我不得不使用 Puppeteer 来自动批量重命名分析中的视图名称。