Using and Creating Community Connectors in Google Data Studio

google-analytics-explained-creating-google-data-studio-community-connectors

Google Data Studio only provides built-in connectors for Google products. Fortunately, it’s still possible to access data from other sources, due to Community Connectors. These are available for sources like public data sets, private company data, and various types of platforms, including social media, CRM, and advertising platforms.

Plus, as users can easily create their own. Building a Community Connector can provide you with access to an Internet data source you or your clients need. You can then promote and even monetize your Community Connector to gain more from your work.

What Community Connectors Are Available?

Before you start developing your Community Connector, check that your idea doesn’t already exist. Google Developers has a full list in its Data Studio Community Connectors gallery.

Creating Your Own Community Connector

Anyone can start scripting, but you’ll need to be a whitelisted developer to test and deploy your connector. If you need to wait to be whitelisted, you can always use standard debugging tools and spoof requests to confirm there are no problems in the meantime.

Acquire an API Key

The first thing to do is gain an API key. You can acquire one by clicking the “Get a Key” button on this page.

Start an Apps Script Project

To start a new apps script project, head to Google Apps Script and click “Create Apps Script.” Delete the myFunction function and rename the project.

Write the Code

The connector code needs to define a specific set of functions for Google Data Studio to execute. It must handle incoming requests and respond correctly. This involves four functions.

The first is getConfig(). This is called to get the configuration for the connector. Google Data Studio will render the connector configuration screen depending on the response. Bear in mind, if the data source requires date as a parameter, you will need to set dateRangeRequired to true.

The next is getSchema(). This is called to get the schema for the request. It is important to implement this function correctly to avoid a number of errors. For one thing, depending on the data source and configuration, the schema may be fixed or you may have to dynamically provide it at request time.

Also, there are an array of field objects that the schema argument expects. These need to be in the same order as your defined schema. If any metric is not requested in the request.fields array, you must exclude it from the reordered return array. Furthermore, you must format the rows correctly.

Another point to note is that user- provided values are returned as a string for each configParam item. This includes CHECKBOX elements and SELECT_MULTIPLE elements, where the return value is a string with comma-separated values.

Finally, the only supported dataTypes are string, number, and boolean. Semantic types, however, are visible in the fields selection screen and are derived from either the automatic semantic type detection process or are manually defined.

The third function is getData(). It is called to get data for the request. Any configuration parameters that the function defines are provided in the request argument.

Finally, you have getAuthType(). This is called to identify what authentication method the third-party service is using.

You can find more information about the functions in the Community Connector API reference.

Create a Manifest Document

To deploy your Script, you need to create a manifest document. Note that this is only possible once you are a whitelisted developer. In the Apps Script development environment, click “View” and then “Show manifest file.” This will create a new file. Use the information here to update the content.google-analytics-explained-creating-google-data-studio-community-connectors2

Deploy Your Connector

You are now ready to deploy your Community Connector. Find “Publish” in the Apps Script development environment and click “Deploy from manifest.” This will open the Deployments screen. To receive the connector link into Google Data Studio for your Community Connector, click the version name or “Get ID.” Then click the connector link that appears. This will lead you to a new window where you can authorize your new connector. Finally, click “Connect,” and you’re all set up.

Now that you’ve created your Community Connector, check it out. Try a couple of tables or charts to ensure everything appears as you expected.

If you like my articles,