Role based embedded reports in data studio

Multiple times we need to build reports to present our data. The Google Data Studio provides a powerful tool to build your own reports with less time and without any coding knowledge.

Google Studio depends on Data Source. The data source is a connection or method, which can be used to connect to our database.

There are multiple types of connectors available on the google data source and we can also build our own connector.

Inbuilt data source provider https://datastudio.google.com/u/0/datasources/create. Here we can use data sources, according to our requirements.

First, we are using Mysql connector:

Step 1: First, add details to our database. Add Click on Authentication. If all details are correct, it will be connected to our database.

Step 2: There are 2 sections. a) You can select a table that will report the data needed. b) You can write own query. Then click on the connect button.

Step 3: According to the query, the column will show there. You can create an explorer report.

https://drive.google.com/file/d/17RvzBabIrOdT5CX8yZwdlFAWYbsxxify/view?usp=sharing

These connectors have a problem. Suppose we have a database of the HR Department. So the Administrator can view all departments’ data, but the Head of a department allows the only view of his department data.

In that case, we need to create a custom data source provider.

Step 1: We need to write a custom data source to https://script.google.com/. First, edit the Application.json. Here we have to update the manifest JSON and Code.gs script.

Application.json

Code.gs

 

For more information https://github.com/googledatastudio/community-connectors/tree/master/JSON-connect/src

Step 2: Deploy your code. After deployment, you get “Deployment id” and direct URL of your Data Source.

Step 3: Need to provide your source JSON URL and allow parameters to override by URL. Allow parameters for our need for data according to department wise and connect to the data source.

https://drive.google.com/file/d/1ys4RCPyWYC8wP31jWtCJcZpqt6SIKnMC/view?usp=sharing

So by using a custom connector, we can show data according to the role.

For publishing your Datasource script or otherwise, you can use less secure https://developers.google.com/datastudio/connector/pscc-requirements

 

Limits of embedding

  • Bookmark links can’t be used with embedded reports. If you need a customized view of the data, use editor filter properties and date ranges applied to the report.
  • Some websites may block the ability to embed their content.
  • Recursive embedding is not allowed: while you can embed a Data Studio report into itself, you won’t see the URL embed component in the embedded report.

Comments