How to change Google Map metrics using a Parameter in Data Studio
In this post I’ll show you a method for how to change Google Map metrics using a Parameter in Google Data Studio.
At the time of writing it is not possible to switch between metrics on a Google Map in Data Studio. If you use a Geo Map you can use Optional Metrics to change the data displayed on the map, but this is not possible if you use a Google Map. But you can get around this by using a parameter.
Below is a video of how it should work. The actual Data Studio dashboard is at the end of the article.
Step 1: Extract Google Analytics data using the Extract Data Connector
So I tried using this method with the regular Google Analytics connector and it didn’t work. I then tried using the Extract Data connector and it worked fine. You’re welcome to try with the regular Google Analytics data though!
I extracted the following data including the following metrics; Sessions, Users, Page Views, Goal Completions and Goal Conversion Rate.
Step 2: Create a Map Metric Parameter
The next step is to create a parameter named map_metric_parameter. It is a text parameter and has the following list of values;
- Sessions
- Users
- Page Views
- Goal Completions
- Goal Conversion Rate
Step 3: Create a Map Metric Field
Now create a calculated field where the value is simply the parameter you’ve just created.
We will name this map_metric_field.
Step 4: Create your Map Metric that you will use in the Google Map
Now that you’ve created your map_metric_parameter and the map_metric_field based on the parameter, we can create the new calculated field we will be using with our Google Map in the report.
Use the following CASE statement in a new calculated field.
CASE map_metric_field
WHEN 'Sessions' THEN Sessions
WHEN 'Users' THEN Users
WHEN 'Page Views' THEN Page Views
WHEN 'Goal Completions' THEN Goal Completions
WHEN 'Goal Conversion Rate' THEN Goal Conversion Rate
END
It should look like this.
Save it and now we should have three new calculated fields in our data source as shown below.
Step 5: Building our Data Studio report
Add a Google Map with Town/City as the location dimension and map_metric as the metric.
I’ve also created a table with Town/City, Country and map_metric.
Add a Drop down Control filter was map_metric_parameter as the Control field.
I’ve also added in a table with all the design elements (row numbers, pagination etc) hidden so that it displays the name of the map metric. Choose the dimension for the table to be map_metric_field.
Step 6: Looking at the final, finished Google Data Studio report
Below is the finished Google Data Studio report. Please note that you can’t view Google Maps inside an embedded Data Studio report and you need to open the report in Data Studio by clicking on the logo in the bottom right corner of the report.
Alternatively click on this link to open the report.
My Other Blog Posts
I hope you found this article about changing Google Map metrics using a Parameter useful and interesting! If you did you might like my other blog posts.
I am trying to use Parameters to swap out metrics for other types of charts and data (ie. not Google maps data). Have you tried this before? I followed the steps from this method but not having any luck! Getting ‘User Configuration Error’ for everything. Would love any suggestions if you have them!
PS – what you did above is amazing though!! Thank you for sharing! (keeping fingers crossed I am able to repurpose)
thank you! Good luck!
I should work for other chart types (I’ve used it for tables, scorecards) and it works fine.
Can you use this method to extract data from a Google My Maps?
I’m not familiar with Google My Maps I’m afraid.
Hey! I’m trying here but I’m getting and error when i try to create the calculated field (Step 4), my metrics (Users, Goals, etc) are not dimensions as you showed. So the CASE formula is returning an error telling that I cant mix dimensions and metrics in a calculated field.