ArticlesBlog

How do Community Connectors Work (DataVis DevTalk: S01)

How do Community Connectors Work (DataVis DevTalk: S01)


[MUSIC PLAYING] MINHAZ KAZI: Welcome
to DataVis DevTalk. I’m your host, Minhaz
Kazi, Developer Advocate for Data Studio. In this video, we will show you
how Community Connectors work. [MUSIC PLAYING] Community Connectors are custom
connectors built in Apps Script that you can use to
connect to your own data. To build a Community
Connector, you’ll develop your code in Apps Script
and then deploy the connector. Then users can start using it. Based on different user
actions in Data Studio, the Data Studio will
execute the script and invoke different functions. Then based on the
function response, Data Studio will take
different actions and render the interface as
well as the data on the screen. In this video, we will show the
Community Connector flow step by step. We will also show
the expected outcomes on screen and the
user interactions to help you understand
how to develop your code. When you develop your connector,
you will write the code and also provide certain
metadata about your connector in the manifest. The manifest will be a
file named appsscript.json, and it will be a part of
your Apps Script project. We will discuss the manifest
in details in a later video. Your code can be
in a single file or distributed across
multiple files in Apps Script. For a basic Community
Connector, you will need to define four
functions in your code. The first function
is getAuthType that tells Data Studio
the authorization type for the connector. The getConfig function
tells Data Studio how the user configuration
screen should be rendered. Then the getSchema
function provides the schema for your data. Finally, the getData function
provides the actual data for the requested
fields to Data Studio. Now let’s see how
a typical connector workflow would look like. This is more of a
simplistic example to better illustrate how the
connector workflow works. Depending on your
implementation and requirements, this workflow might
somewhat vary. To use a connector,
the user first selects it in Data Studio. In our example, we are showing
the Google Fit connector that lets you fetch
your Google Fit data. Once the user has
selected the connector, Data Studio now executes
the connector script and calls the
getAuthType function. Based on the response
provided by the connector, Data Studio will then trigger
the required authorization flow. The user will see the
AuthFlow on the screen and complete it to provide
authorization to the connector. For our example, only
the Google Authorization is needed for the connector. For your implementation,
you might need additional authorization
from a third party site. After the authorization
is complete, Data Studio will call
the getConfig function from the script. In this function you can define
what configuration information you’d like to collect
from the user. Based on the response
from the script, Data Studio will render the
configuration’s interface for the connector. Here we can see
that the Google Fit connector needs only
one configuration input from the user. It asks the user which type
of data it should return. The user completes all the
necessary configuration and clicks Connect. At this point Data Studio has
the necessary configuration and calls the getSchema function
to get the schema of the data. It will render the field
screen and let the user update the schema if needed. In our example, we can see that
for the selected configuration, the Google Fit connector
has a schema with five different fields. The user clicks the
Create Report button to move on to the next step. Now the user will be shown a
blank Data Studio dashboard where they can add
charts and tables to create their own report. When the user adds a
new chart Data Studio will make the getData call
to the connector script. The connector will then fetch
the data from the Google Fit API and send it
back to Data Studio. Then, Data Studio will render
the chart with the data. This is basically how a
Community Connector works. Our example showed a full
workflow from authorization to rendering the data. Now if I shared the Google Fit
dashboard with someone else and they view the
dashboard, Data Studio will only make the data
calls to the connector to refresh and update the data. So when a dashboard
is viewed only the getData calls
will get executed. So that was an overview of
how Community Connectors work in Data Studio. In our next videos we will
show you step by step how you can build your own connector. You can always go to
our developer site at
developers.google.com/DataStudio for more information. If you enjoyed this
video, like and subscribe to the GCP channel for
more videos like this. Thanks for watching. [MUSIC PLAYING]

Comment here