How to pass URL parameters in Looker Studio?
Struggling with URL parameters in Looker Studio? Good news, in this article you’ll find everything you need to know to make it work !
This is a very useful feature for database connections, which allows you to control what users see when they first land on your report. Some people use it to make sure people focus on what matters, others to restrict access, possibilities are endless. In this article, we’ll review how to pass URL parameters in Looker Studio (previously known as Data Studio).
Looker Studio connectors we use on a daily basis and are happy with (w/ free trials): Supermetrics - Windsor - Catchr - PMA - Funnel
Not sure which one to pick? Reviews here and there. Still unsure?! Contact us with your tech stack and budget, and we’ll guide you in the right direction:
Create a database connection and add two parameters
First of, please create a database connection. In our example, we’ll use a Big Query custom query to read a table we’ve populated with housing data from the Spanish market (please note that not all database connections accept parameters).
We’ve created 2 parameters using the button Add a parameter at the bottom:
One called ciudad_param, to control for the city (default value: BARCELONA). This is a STRING
One called multiplicator (default: value: 1), to make some calculations later on. This is Number (whole)
We end up having something like this:
Create a table and two controls
Once the data source has been created, please add a table with data from your source, and add two Input box controls, one for each parameter we’ve just created. In the table, we’ve added a new calculated field:
Precio x Multiplicator
You should see the default value you’ve set in the input boxes:
Change settings, find parameters name, and you’re good to go!
In order to be able to pass URL parameters, you need to change a few settings:
Under Resource, Manage variables, next to your parameter please tick Allow to be modified in report URL
Make sure to note the name of your parameters, as this is what we’ll use to pass parameters
We’re almost there! But before, we need to go under File > Report settings, and tick the Enable viewer filters in report link.
Now, let’s say we want to see data for MADRID, with a multiplicator of 2. In the input box, please insert MADRID and 2. You should now see in the address bar of your browser the params strings, that should look like:
params={“ds3.ciudad_param”:”MADRID”,”ds3.multiplicator”:2}
Now, to create the JSON to pass the parameters, proceed to https://www.urlencoder.org/, copy this JSON, click ENCODE, and then re-copy the results the page is giving you.
Back to your report:
Refresh the browser and go to Viewer mode
In the address bar, copy the report path, which is something like https://lookerstudio.google.com/reporting/xxx-xxx-xxx-xxx-xxx/page/ABCDE
Add an interrogation mark ? at the end of that url, copy the new whole thing
Replace %3D right after params with an equal sign =
And hat’s it, you’ve just passed URL parameters in Looker Studio, just like the image below:
In this quick article, we’ve reviewed how to pass URL parameters in Looker Studio.
PROBLEM SOLVED !
Tools we use and we like:
Todoist: for tasks management
Monday: for projects management, when tasks fall short
Tropical Server: our friends in charge of the hosting of this very website!
Tools we’d like to use (if we had the budget…):