바로가기

링크를 사용하여 커뮤니티 커넥터의 배포를 공유할 수 있습니다. 사용자가 링크를 클릭하면 커넥터가 선택된 Looker Studio로 바로 이동합니다.

커뮤니티 커넥터의 직접 링크를 받으려면 다음 단계를 따르세요.

  1. Apps Script로 이동하여 공유할 커뮤니티 커넥터의 프로젝트를 엽니다. 배포 > 배포 관리를 클릭합니다.
  2. 활성 배포를 클릭하여 공유합니다. Looker Studio 부가기능 URL 아래에 선택한 배포의 Looker Studio로 연결되는 직접 링크가 표시됩니다. 복사를 클릭합니다. 또는 배포 ID에서 복사를 클릭하고 복사한 배포 ID를 다음 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 인코딩합니다. encodeURIComponent JavaScript 함수를 사용하는 것이 간단한 방법입니다.

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을 빌드하려면 커넥터의 배포 ID가 필요합니다.

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