Data Studio doesn't have an option to display country flags in your table charts. But it's easy to create a country flag column yourself.
As we saw in this article, you can add images to tables. We will use the same technique to compose the urls of the flags from their country codes.
Step 1: Make sure you have country codes
You need a field containing two-letters ISO codes for your countries. If your data source is Google Analytics, this information is already available in the "Country ISO Code" field. It contains values like: US, FR, GB, IN...
Your codes should match the names of the images we will use in the next step:
Step 2: Get country flag images
To display images in your reports, these images need to be accessible somewhere on the Internet.
We could tell you to download a pack of country flags and figure where to host them yourself. But we made it easier for you: You can use our images.
Fill the form below to receive an email containing the public location of our flags. We need your email address so that we can contact you if we ever need to move the images somewhere else, or stop offering this free service.
If you don't receive our email, contact us at [email protected].
About these images:
- We use a collection of flags created by Hampus Nilsson. It's available in this Github repo. You can preview the flags here. Thanks, Hampus!
- As the author says: "The source files were taken from Wikipedia and are not under copyright protection since flags are effectively in public domain".
- Our files are hosted on Github Pages with the Cloudflare CDN in front.
Step 3: Create a new image field for your flags
Create a new calculated field on your data source. Give it a name, then write a formula like this one:
It uses 3 functions:
1- LOWER, to convert Google Analytics "Country ISO Code" field from values like:
"US, FR, GB, IN ..." into "us, fr, gb, in ..."
2- CONCAT, to build the flags urls from the domain, country code, and file extension. Example: "https://the-url-we-sent-you-by-email-here/us.png"
3- IMAGE, to create an image field
Step 4: Add the new column to your table
Add the new country flag image field to your table chart as a dimension:
You're done! Here is our end result with Google Analytics data: