如何向Data Studio过滤器添加标签

时间:2020-02-05 10:38:49

标签: google-apps-script google-data-studio

我想在Data Studio中为我的过滤器设置标签和值。选择客户后,从请求中获取customer_id并将其设置为Google Apps脚本getData()函数中URL的参数

这是我的代码:

 var data = {};

  try {
    var url = 'http://transaction/Reporting'
    if (request.dimensionsFilters && request.dimensionsFilters.length > 0) {
      var obj = request.dimensionsFilters[0][0]
      var value = obj.values[0]
      var field = obj.fieldName

      data[field] = value

    }

    var options = {
      'method' : 'post',
      'contentType': 'application/json',
      'payload' : JSON.stringify(data)
    };


  var response = UrlFetchApp.fetch(url,options);

0 个答案:

没有答案