标记管理器容器列表的Google App脚本

时间:2018-04-19 07:29:01

标签: google-apps-script google-sheets google-tag-manager

我正在运行谷歌应用程序脚本以获取我的GTM帐户的容器列表。我有以下代码:

TagManager.Accounts.Containers.list(parent)

parent =我的GTM帐户ID,我甚至尝试将其作为字符串,EG“xxxxx”。我确信GTM帐户ID是正确的。

返回以下错误:

  

未捕获错误:响应代码:404。消息:未找到。   在fetchContainers(代码:19)

有人可以帮助我吗?

2 个答案:

答案 0 :(得分:1)

"Parent" is a path

Screenshot of GTM documentation describing the parent argument

仅插入ID将提供无效路径,并且由于API客户端尝试从该路径检索响应,因此无效路径将导致错误。

答案 1 :(得分:1)

你需要使用这样的电话:

kable

您可以在此处找到完整且有效的示例:

http://www.appsscript.it/tutorial/lista-dei-containers-di-google-tag-manager-in-spreadsheet-con-google-apps-script/