How to create a Connector Parameter within Google Data Studio
By Matt Redford
One of the problems with Google Data Studio was that custom connectors were a one way link. There wasn’t a way to communicate back to the data source to update the data within the dashboards accordingly. This isn’t as flexible as it should have been.
Whilst data controls enable some control over the data that appears these have predefined rules and can only be used with a number of official Google connectors (YouTube, Google Ads etc).
Connector parameters are our saviour here! These enable a flexible two way data control between Data Studio and the data source for a custom connector. I’ve used this recently for a project and it enabled me to combine multiple planned connectors into one super connector. I’ll explain how to set up a connector parameter in this post.
Adding a Connector Parameter
Following on from my recent post about creating a data studio connector using the Socialbakers API we needed to create a new connector for several internal accounts under the same brand. Previously this would have needed a separate connector for each account. Using a connector parameter we’re going to create an option for the user to select individual accounts.
Enabling a connector parameter requires a code update to the custom connector within Google Script. The item with name “site_name” below was added to the configParams array within the config variable. If you’re not aware of the code structure for Data Studio connectors I’d recommend reading my previous post above or the official Google documentation.
Two options were added under a display name of “Site Name”. This example will generate a drop down menu which enables the user to choose from one of two options, Account 1 and Account 2. This is defined by the “label” field. The “value” field will be the hidden value behind the label. This value will be the profile ID which will be used to update the API request and get data for that account accordingly.
The “type” of “SELECT_SINGLE” defines this as a drop down menu. However “TEXTINPUT” is also accepted which will accept a custom text input. This article provides the necessary syntax for each input type.
We can refer to the chosen “Site Name” option later in the script by the following line of code. This captures the associated “value” field.
Once the connector has been configured we can proceed with publishing it. Within the following connector set up page we’ll now be able to see this as a configurable parameter.
Ticking the “Allow ‘Site Name’ to be modified in reports” enables the parameter to be updated directly within a Data Studio dashboard.
Connector parameters enable a good amount of flexibility for handling data with Data Studio. It enables two way communication between data source and dashboard. In this post we’ve talked about using it to update the data using different accounts dynamically within a dashboard. There are numerous other possibilities. Experiment and have fun with it!
Maximise business opportunity with data-driven decision making. Find out more about our data team.
Image by Bruno Glätsch, Pixabay