您可以通过链接共享社区连接器的任何部署。用户点击该链接后,会直接转到 Looker 数据洞察,其中您的连接器已被选定。
要获取社区连接器的直接链接,请按以下步骤操作:
- 转到 Apps 脚本,然后打开要共享社区连接器的项目。点击部署 > 管理部署。
- 点击要共享的活跃部署。在 Looker Studio 插件网址下,系统会显示所选部署的 Looker Studio 直接链接,然后点击复制。或者,在部署 ID 下,点击复制,并将复制的部署 ID 附加到以下网址以形成直接链接:
https://lookerstudio.google.com/datasources/create?connectorId=DEPLOYMENT_ID
- The direct link can be shared with users. For example, send it via email, post it on a website, blog, social media, etc.
Preconfigure a direct link
If you know the configuration values that your users will want ahead of time, you can provide additional query parameters to pre-populate the connector configuration. The pre-populated configuration can still be modified by users.
Create a preconfigured direct Link
To create a preconfigured direct link, add the following optional query parameters:
connectorConfig
- A URL encoded JSON string containing key-value pairs to use to pre-populate the connector configuration.- Key names must match the parameter names defined in the connector config.
TEXTINPUT
,TEXTAREA
, andSELECT_SINGLE
values should be strings.CHECKBOX
values should be a boolean.SELECT_MULTIPLE
values should be an array of strings.
reportTemplateId
- An identifier for the default reporting template to use for the connector. If a default template is set in the connector manifest, this value will override the manifest. See How To Add The Report Template for the value to use.
Example
The following example illustrates how to create a direct link to the
StackOverflow Questions community connector. The direct link
pre-populates the connector configuration to use the looker-studio
tag on
Stack Overflow.
Step 1: Create the config JSON
The keys for the config JSON are the names of each configuration item. For the
Stack Overflow config, these names are tagged
, pagesize
, and
sort
.
JSON before encoding
{
"tagged": "looker-studio",
"pagesize": 25,
"sort": "activity"
}
第 2 步:对网址进行编码
创建配置 JSON 后,对对象进行网址编码。一种简单的方法是使用 encodeURIComponent
JavaScript 函数。
对网址进行编码
// get a reference to the jsonConfig
var jsonConfig;
var encoded = encodeURIComponent(jsonConfig);
最终会得出以下编码字符串:
"%7B%22tagged%22%3A%22looker-studio%22%2C%22pagesize%22%3A%2225%22%2C%22sort%22%3A%22activity%22%7D"
第 3 步:构建网址
使用以下代码可构建直接链接。请注意,您将需要连接器的部署 ID 来构建网址。
这将返回以下编码网址,即连接器的预填充直接链接:
https://lookerstudio.google.com/datasources/create?connectorConfig=%7B%22tagged%22%3A%22looker-studio%22%2C%22pagesize%22%3A%2225%22%2C%22sort%22%3A%22activity%22%7D&reportTemplateId=1lR9CGfx3uyQp6oz7oAgA1rsqZViA-IQs&connectorId=AKfycbwGMj-oe532y-NEbMHo-KLUCEz0EEGOZj-3lhEgw7q65-hs-T_F9B3Qjw