If you’re a digital analyst looking for actionable insights that answer “where” questions, you already know that effective map visualizations are a must-have in your arsenal. Build your maps wisely, make them beautiful, and they’ll help you develop smart insights and weave compelling stories. This tutorial shows how you can use Tableau Desktop 8.2 and Google Analytics to create beautiful, immediately useful maps.
To make this tutorial realistic, the focus is on creating a very simple Tableau map based on basic Google Analytics site data for Flip the Media. The questions that we’ll answer with this map are as follows:
- Which top 10 countries generated the most visits to Flip the Media during the first six months of this year?
- How many visits did each of these countries generate during this time frame?
Why Use Google Analytics and Tableau Together?
Many, if not most, analytics tools provide map visualizations by default. For example, the following image shows a standard map from Google Analytics. The map provides a color-coded legend to indicate the countries that generated visits to Flip the Media between January 1 and June 30, 2014. But how helpful is this map, really?
Yes, there’s a legend at the bottom of the map, from which we can infer that the United States generated the greatest number of visits during this six-month period (28,242 to be exact). The problem is, although most of the rest of the countries in the world also generated visits to Flip the Media, we don’t know how many visits the other countries generated. The map’s color gradient is not subtle enough to help us make those distinctions, and there are no labels to indicate specific visit numbers for any country.
If we were logged into Google Analytics, we could also review a data table that lists the number of visits generated by all relevant countries during this six-month period and a bevy of other useful metrics. But for now, how do we make this map more immediately useful? Tableau provides rapid visualization capabilities, drag-and-drop ease and customization features that enable us to transform the raw data provided by Google Analytics into a map that’s more compelling, visually appealing and informative.
First, Connect Tableau to Google Analytics
To access and import the raw data that we’ll use to create our map in Tableau, we need to connect Tableau Desktop to Google Analytics. To complete this step, follow the instructions in the Tableau Desktop online Help Google Analytics topic. Note that step 5 in that topic describes how to complete the Google Analytics Connection dialog box. To create the map in this tutorial, make sure that you configure the connection dialog box so that it appears similar to the image shown here.
After our Google Analytics data is imported into Tableau, a blank workbook appears with Country/Region as a dimension (because this field contains qualitative, categorical data) and # Visits as a measure (because this field contains quantitative, numeric data).
Next, Create the Initial Map in Tableau
The beauty of Tableau is that we can quickly drag and drop dimensions and measures as needed to experiment with different views and create just the right visualization. To create an initial map, we’ll need to do the following:
- Click and drag the Country/Region dimension from the Dimensions area to the Marks area.
- Click and drag the # Visits measure from the Measures area to Color.
- On the Map menu, click Map Options.
- In the Map Options pane, select the check boxes shown in the Map Options area in the following image. Your map should appear as shown in the right side of the image.
This is a start, but right now, this map isn’t looking much more useful or better than the Google Analytics map. We’ll need to customize the map to make it more useful and visually pleasing.
Now It’s Time to Customize the Map
For this example, we’ll change the palette from the default green palette to a more informative and visually pleasing palette, one that is known in Tableau parlance as the “Temperature Diverging” palette.
- To change the color palette, in the Marks area, click Color, click Edit Colors, select the Temperature Diverging palette, select Reversed, and then click OK. The reason why we’re selecting the Reversed option for this map is that we want the country (or countries) that generated the highest number of visits to appear green, not red. This approach to visualization may be less confusing for those who are trained to view the color green as indicating relatively strong performance and the color red as indicating relatively weak performance.
- Click Color again and set the transparency in the range of 65% to 68%. Doing this lessens the color intensity, so that your colors don’t overwhelm the country/region borders and names.
- If the Map Options pane is still open in the left side of the workbook, close it to expose the Data pane. In the Data pane, drag the #Visits measure from the Measures area to Label. The map now displays the number of visits for each country that generated visits to Flip the Media. In our case, the sheer volume of data clutters the map and we’ll need to filter out the noise by adjusting the range of visits displayed.
- Right-click SUM(Visits), and then click Show Quick Filter.
- The quick filter pane appears to the right of the map.
- Drag the left slider arrow to the right to adjust the minimum value upward, until only the labels for the top 10 countries are showing.
- A natural question to ask at this point is how will we know how far upward to adjust the minimum value, to display only visit numbers for the 10 countries that generated the highest number of visits? This is where logging in directly to Google Analytics can help. To confirm the top 10 countries and the number of visits that each country generated, open Google Analytics and check the Audience > Geo > Location report data table that appears immediately beneath the map. Based on the data table shown in the following image, we know that the minimum value should be set to 272.
Note: As we finalize our map, notice that labels that indicate the number of visits may obscure the names of countries/regions. To arrange the labels in a way that does not cover names and is visually pleasing, click the label that you want to move and drag it to the desired location. The map should appear similar to the following:
Finally, Save and Send Your Map
- Before closing the Tableau file, it may be helpful to take a screenshot of the map, export an image of the map, or both. To export an image, on the Worksheet menu, click Export Image, clear all check boxes except for View and Color Legend, and then save the image to the location that you want.
- For optimal flexibility, consider saving the file in Tableau packaged workbook (*.twbx) format. Saving the file in this format will enable you to send the file to others in a format that they can open and work with directly in Tableau, if needed.
One final tip, for packaging Tableau Desktop *.twbx files for others to view and interact with. If you need to send files that you’ve created with Tableau Desktop to clients or others who do not have this program, you can provide these individuals with instructions and a link to install the Tableau Reader. They can then view the files and work with any interactive elements that you’ve included.