با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
به عنوان مثال، فرض کنید توسعه دهنده X یک برنامه وب برای مشتریان خود دارد. مشتریان با استفاده از اطلاعات کاربری خود وارد اپلیکیشن می شوند و می توانند داده های فروش فروشگاه های مختلف را مشاهده کنند. هر مشتری به لیست متفاوتی از فروشگاه ها دسترسی دارد. توسعهدهنده میخواهد داشبورد Looker Studio را در برنامه خود تعبیه کند تا وقتی مشتری وارد میشود، مشتری فقط دادههای فروش فروشگاههایی را که به آنها دسترسی دارند ببیند. برای اینکه این فرآیند کار کند، مشتریان نباید به حساب Google خود وارد شوند.
راهحل پیشنهادی به توسعهدهنده نیاز دارد تا یک Connector Community ایجاد کند، یک رمز را از طریق URL جاسازی شده عبور دهد و سپس دادهها را بر اساس توکن فیلتر کند.
الزامات
بینندگان داشبورد به برنامه شخص ثالث وارد می شوند.
برنامه باید یک رمز منحصر به فرد را از طریق URL جاسازی شده به داشبورد Looker Studio ارسال کند. رمز را می توان برای جستجوی اطلاعات فیلتر یا رمزگذاری اطلاعات فیلتر در داخل استفاده کرد.
Connector Community باید بتواند رمز را به مقادیر فیلتر تبدیل کند.
محدودیت ها
اگر مشتری G Suite هستید و سرپرستتان اشتراکگذاری فایلهای Drive را با «هر کسی که پیوند دارد» غیرفعال کرده است، نمیتوانید گزارش را با کاربران خارج از سازمانتان به اشتراک بگذارید.
راه حل
تمام مراحل زیر را برای اجرای راه حل کامل کنید.
توکن کاربر را در برنامه وب ایجاد کنید
برای هر کاربر وارد شده در برنامه وب خود یک نشانه منحصر به فرد ایجاد کنید. در مرحله بعد این نشانه را به داشبورد تعبیه شده ارسال خواهید کرد.
شما باید از رمز برای فیلتر کردن داده های مرتبط استفاده کنید. گزینه ها عبارتند از:
یک نقطه پایانی API ایجاد کنید که داده های فیلتر شده یا اطلاعات کاربر را برای یک توکن خاص برمی گرداند.
اطلاعات کاربر را در توکن رمزگذاری کنید تا بعداً در کانکتور رمزگشایی شود.
getConfig() باید حداقل یک آیتم پیکربندی را برگرداند. این برای گرفتن یک نشانه از پارامترهای URL جاسازی شده استفاده خواهد شد.
functiongetConfig(request){varcc=DataStudioApp.createCommunityConnector();varconfig=cc.getConfig();config.newTextInput().setId('token').setName('Enter user token');// TODO: Add additional config values if applicable for your connectorconfig.setDateRangeRequired(false);config.setIsSteppedConfig(false);returnconfig.build();}
getData() از طریق شی request.configParams به توکن دسترسی خواهد داشت. از رمز برای واکشی داده های فیلتر شده یا فیلتر کردن داده های واکشی شده موجود استفاده کنید. به دنبال مثال بالا، توکن request.configParams.token خواهد بود. در getData() توکن به نقطه پایانی REST API ارسال میشود تا لیستی از شناسههای فروشگاه دریافت شود. سپس از این شناسه های فروشگاه برای ساخت پرس و جوی SQL برای واکشی داده های فروش استفاده می شود.
varSTORE_ID_API='https://www.example.com/api/storeid';varQUERY_STRING_PREFIX="SELECT StoreName, Sales from stores"functiongetData(request){vartoken=request.configParams.token;varstoreIds=getStoreIdList(token);varqueryString=constructQueryString(storeIds);varfetchedData=fetchData(queryString);// rest of getData() implementation}functiongetStoreIdList(token){varurl=STORE_ID_API;varresponse=UrlFetchApp.fetch(url);varparsedResponse=JSON.parse(response);returnparsedResponse.storeIds;}functionconstructQueryString(storeIds){varstoreIdString=storeIds.join(',');varqueryString=QUERY_STRING_PREFIX+' WHERE storeId in ('+storeIdString+')';returnqueryString;}
مقدار توکن تولید شده به صورت پویا را با استفاده از پارامترهای URL به گزارش استودیو Looker تعبیه شده ارسال کنید. نشانی اینترنتی جاسازی شما شبیه به این خواهد بود:
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eEmbed Looker Studio dashboards in third-party applications, allowing clients to view relevant data without Google logins.\u003c/p\u003e\n"],["\u003cp\u003eSecurely filter data using unique, short-lived tokens passed through the embed URL, fetched by a custom Community Connector.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers need to create a Community Connector, handle token generation and data filtering, and configure Looker Studio sharing settings for embedding.\u003c/p\u003e\n"],["\u003cp\u003eTokens can either directly contain encrypted filter information or be used to retrieve it from an API endpoint, enhancing data security.\u003c/p\u003e\n"],["\u003cp\u003eG Suite users need to ensure Drive sharing is enabled for "Anyone with a Link" for external access to the embedded dashboard.\u003c/p\u003e\n"]]],[],null,["# Row-level security for embedded viewers\n\n| **Objective:** A viewer of an embedded dashboard on a third-party platform will see only the data relevant for them, without the user logging into their Google account.\n\nFor example, let's assume developer X has a web application for their clients.\nClients log in to the app using their own credentials and can view sales data\nfor different stores. Each client has access to a different list of stores. The\ndeveloper would like to embed a Looker Studio dashboard in their application so\nthat when a client logs in, the client sees only the sales data for the stores\nthey have access to. Clients should not have to log into their Google account\nfor this process to work.\n\nThe proposed solution will need the developer to create a Community Connector,\npass a token through the embed URL, and then filter data based on the token.\n\nRequirements\n------------\n\n- Dashboard viewers will log in to the third-party application.\n- The application should pass a unique token to the Looker Studio dashboard through embed URL. The token can either be used to lookup filter information or have the filter information encrypted within.\n- The Community Connector should be able to convert the token into the filter values.\n\nLimitations\n-----------\n\n- If you are a G Suite customer and your administrator has disabled sharing Drive files to \"Anyone with a Link\", you will not be able to share the report with users outside your organization.\n\nSolution\n--------\n\nComplete all the following steps to implement the solution.\n\n### Generate user token in web app\n\nGenerate a unique token for each logged-in user in your web application.You will\nbe passing this token to the embedded dashboard in a later step.\n\nYou should use the token to filter relevant data. Options include:\n\n- Create an API endpoint which return filtered data or the user information for a specific token.\n- Encrypt the user information in the token so that it can be decrypted later in the connector.\n\n### Create a new Community Connector\n\nReview [How Community Connectors Work](https://youtu.be/1u1wOD3RjSA?list=PLIivdWyY5sqLNJttHVnNtjKVgt2PGF4Js&t=15) and complete the\n[Community Connector Codelab](/looker-studio/connector/get-started) to get started. Use the\n[Local development tooling for creating connectors](/looker-studio/connector/local-development) for a faster and easier\ndevelopment process.\n\n### Write the connector code\n\n1. [`getConfig()`](/looker-studio/connector/reference#getconfig) should return at least one config item. This will be used to\n capture a token from embed URL's parameters.\n\n **Caution:** You should not pass user credentials via this method. \n\n function getConfig(request) {\n var cc = DataStudioApp.createCommunityConnector();\n var config = cc.getConfig();\n\n config\n .newTextInput()\n .setId('token')\n .setName('Enter user token');\n\n // TODO: Add additional config values if applicable for your connector\n\n config.setDateRangeRequired(false);\n config.setIsSteppedConfig(false);\n\n return config.build();\n }\n\n2. [`getData()`](/looker-studio/connector/reference#getData) will have access to the token through the\n `request.configParams` object. Use the token to fetch filtered data or\n filter existing fetched data. \n\n Following the above example, the token would be\n `request.configParams.token`. In `getData()`, the token is passed to a REST\n API end-point to get a list of *Store Ids* . These *Store Ids* are then used\n to construct the SQL query to fetch sales data.\n\n var STORE_ID_API = 'https://www.example.com/api/storeid';\n var QUERY_STRING_PREFIX = \"SELECT StoreName, Sales from stores\"\n\n function getData(request) {\n var token = request.configParams.token;\n\n var storeIds = getStoreIdList(token);\n var queryString = constructQueryString(storeIds);\n var fetchedData = fetchData(queryString);\n\n // rest of getData() implementation\n }\n\n function getStoreIdList(token) {\n var url = STORE_ID_API;\n var response = UrlFetchApp.fetch(url);\n var parsedResponse = JSON.parse(response);\n return parsedResponse.storeIds;\n }\n\n function constructQueryString(storeIds) {\n var storeIdString = storeIds.join(',');\n var queryString = QUERY_STRING_PREFIX\n + ' WHERE storeId in ('\n + storeIdString\n + ')';\n return queryString;\n }\n\n### Create the dashboard\n\n1. Understand how [deployments and versions](/looker-studio/connector/deploy) work for connectors.\n2. [Create a production deployment](/looker-studio/connector/deploy) for the connector.\n3. Use the Production deployment link to create a data source and a report in Looker Studio.\n4. For the `token` config parameter, [Allow report viewers to modify parameter values](/looker-studio/connector/data-source-parameters#allow_report_viewers_to_modify_parameters_values).\n5. [Share the dashboard](/looker-studio/connector/View%20only) with selected users or with \"Anyone with link\".\n6. [Enable embedding](https://support.google.com/looker-studio/answer/7450249) for the report.\n\n### Embed the dashboard in your platform\n\n1. Understand how [Report URL parameters](/looker-studio/connector/data-source-parameters#set_url_parameters) work.\n2. Pass the dynamically generated token value using URL parameters to the embedded Looker Studio report. \n Your embed url will look similar to this: \n\n ```scdoc\n `https://lookerstudio.google.com/embed/reporting/REPORT_ID/page/PAGE_ID?config=%7B%22ds0%22%3A%7B%22token%22%3A%22TOKEN_VALUE%22%7D%7D\n ```\n\nRecommendations\n---------------\n\n- You should create a **short-lived** token.\n- Ensure the dashboard does not leak any information with viewed with an invalid token."]]