我想在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);