ลิงก์โดยตรง

คุณสามารถแชร์การติดตั้งใช้งานปลั๊กอินจากชุมชนสำหรับใช้ลิงก์ข้อมูลได้ เมื่อผู้ใช้ไปตามลิงก์ ระบบจะนําผู้ใช้ไปยัง Looker Studio โดยตรงพร้อมกับเลือกเครื่องมือเชื่อมต่อไว้

หากต้องการรับลิงก์โดยตรงสำหรับปลั๊กอินจากชุมชนสำหรับใช้ลิงก์ข้อมูล ให้ทำตามขั้นตอนต่อไปนี้

  1. ไปที่ Apps Scripts และเปิดโปรเจ็กต์ของปลั๊กอินจากชุมชนสำหรับใช้ลิงก์ข้อมูลเพื่อแชร์ คลิกทำให้ใช้งานได้ > จัดการการทำให้ใช้งานได้
  2. คลิกการทำให้ใช้งานได้ที่ใช้งานอยู่เพื่อแชร์ ในส่วน URL ส่วนเสริมของ Looker Studio ลิงก์โดยตรงไปยัง Looker Studio สําหรับการทำให้ใช้งานได้ที่เลือกจะปรากฏขึ้น ให้คลิกคัดลอก หรือในส่วนรหัสการทำให้ใช้งานได้ ให้คลิกคัดลอกและเพิ่มรหัสการทำให้ใช้งานได้ที่คัดลอกลงใน URL ต่อไปนี้เพื่อสร้างลิงก์โดยตรง
    https://lookerstudio.google.com/datasources/create?connectorId=DEPLOYMENT_ID
  3. The direct link can be shared with users. For example, send it via email, post it on a website, blog, social media, etc.

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.

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, and SELECT_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: เข้ารหัส URL

หลังจากสร้าง JSON ของการกำหนดค่าแล้ว ให้เข้ารหัส URL ออบเจ็กต์ วิธีง่ายๆ คือการใช้ฟังก์ชัน JavaScript encodeURIComponent

URL การเข้ารหัส

// 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: สร้าง URL

โค้ดต่อไปนี้จะสร้างลิงก์โดยตรง โปรดทราบว่าคุณจะต้องใช้รหัสการทำให้ใช้งานได้ของเครื่องมือเชื่อมต่อเพื่อสร้าง URL

data-studio/links.gs
// These variables should be filled in as necessary for your connector.
var configJSON;
var templateId;
var deploymentId;

var params = [];

const jsonString = JSON.stringify(configJSON);
const encoded = encodeURIComponent(jsonString);
params.push('connectorConfig=' + encoded);

params.push('reportTemplateId=' + templateId);

params.push('connectorId=' + deploymentId);

const joinedParams = params.join('&');
const URL = 'https://datastudio.google.com/datasources/create?' + joinedParams;

การดำเนินการนี้จะแสดง URL ที่เข้ารหัสต่อไปนี้ ซึ่งเป็นลิงก์โดยตรงที่มีการป้อนข้อมูลไว้ล่วงหน้าสำหรับเครื่องมือเชื่อมต่อ

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