Bạn có thể chia sẻ bất kỳ bản triển khai nào của Trình kết nối cộng đồng bằng một đường liên kết. Khi người dùng nhấp vào đường liên kết đó, họ sẽ được chuyển thẳng đến Data Studio với trình kết nối của bạn đã được chọn.
Để lấy đường liên kết trực tiếp cho trình kết nối cộng đồng, hãy làm theo các bước sau:
- Chuyển đến Apps Script rồi mở dự án của Trình kết nối cộng đồng để chia sẻ. Nhấp vào Triển khai > Quản lý bản triển khai.
- Nhấp vào bản triển khai Đang hoạt động để chia sẻ. Trong phần URL tiện ích bổ sung dành cho Data Studio, một
đường liên kết trực tiếp đến Data Studio cho bản triển khai đã chọn sẽ xuất hiện. Hãy nhấp vào
Sao chép. Ngoài ra, trong phần Mã nhận dạng bản triển khai , hãy nhấp vào Sao chép rồi thêm Mã nhận dạng bản triển khai đã sao chép vào URL sau để tạo thành một đường liên kết trực tiếp:
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_SINGLEvalues should be strings.CHECKBOXvalues should be a boolean.SELECT_MULTIPLEvalues 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"
}
Bước 2: Mã hoá URL
Sau khi tạo JSON cấu hình, hãy mã hoá URL của đối tượng. Một lựa chọn dễ dàng
là sử dụng hàm JavaScript encodeURIComponent.
Mã hoá URL
// get a reference to the jsonConfig
var jsonConfig;
var encoded = encodeURIComponent(jsonConfig);
Kết quả là chuỗi đã mã hoá sau:
"%7B%22tagged%22%3A%22looker-studio%22%2C%22pagesize%22%3A%2225%22%2C%22sort%22%3A%22activity%22%7D"
Bước 3: Tạo URL
Đoạn mã sau đây tạo đường liên kết trực tiếp. Xin lưu ý rằng bạn cần có Mã nhận dạng bản triển khai của trình kết nối để tạo URL.
Thao tác này sẽ trả về URL đã mã hoá sau đây, một đường liên kết trực tiếp được điền sẵn cho trình kết nối:
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