Google Data Studio

Google Data Studio annotations as in Google Analytics

Few weeks ago during the Emerce GAUC 2020, Brian Stark – product manager for Google Analytics – made amazing announcements about incoming new features for GA Application + Web properties, including an annotations API! It is the kind of API that was so expected by GA users to automate dated data context, and so to report it easily for impact studies & automatic correlation detection. Technically, it means also that we will get Google Data Studio annotations for Google Analytics app+web data!

This is the future. For now, we need to find custom solutions to create Google Data Studio annotations system addressing this kind of needs for Google Universal Analytics, and any other data in general.
Moreover, we can consider that this device for data context should be external to our main data analytics collection device.
After all, if we own a data warehouse (or data lake if you prefer sailing) storing and providing data from several sources, our annotations system for important life events information will not be dependent to a specific source but it should be cross-source & cross-functional?


Google Data Studio annotations like inside Google Analytics

So let’s deploy – inside our report – a dynamic Google Data Studio annotations system, like we can use inside Google Analytics, giving dated context to our data, combining simple built-in features provided by our favorite data viz tool.

My example is based on Google Analytics data but, of course, we can apply exactly the same thing for other statistics and data.


The result

The result below is based on the following elements:

  • Google Sheets file storing and maintaining Google Data Studio annotations data
  • Blended data source with annotations and metrics from the main data source
  • Combo chart displaying metrics as time series chart and annotations as column chart
  • Table chart listing annotations, filterable with the combo chart


1. Google Sheets file as Google Data Studio annotations data

First, let’s create our Google Data Studio annotations source: A simple Google Sheets file, easy to maintain by all your team providing context with events related to all work fields, as example for digital activities:

  • Marketing: Offers, campaigns, product marketing…
  • IT and application: Release, hot fix…
  • SEO: onsite and offsite actions, search engines filters..
  • Analytics: Change in measurement plan, optimizations, AB testing launching…
  • External events: Regulatory updates, crisis and gradual government decisions…

The sheet will be composed of the following columns:

  • Event date
  • Status: To decide if the event is visible in our report (Draft or Published)
  • Category: like Ads, application release, SEO, Analytics…
  • Event: Description of the event
  • Comments: Additional information, not necessarily displayed in Data Studio

We can also imagine to add other columns like “weight” or “probability of impact” to sort/filter events following risk management requirements but let’s keep it simple for this example…

At last, combining Google Sheets with Google Form for filling control purposes could be a good idea following your team and the wished workflow of annotation contributions.


Google Data Studio - Google Sheets Annotations as data source

2. Google Data Studio configuration

Now, we can add the Google Sheets tab inside our Data Studio report, as a data source, in addition to your main statistics data source (Google Analytics in this example).

Blended data

Then, we blend data, using Google Analytics as the first left join data source, then the annotations sheet using date as key, selecting the following fields:

  • Google Analytics
    • Sessions as time serie metrics
  • Annotations sheet
    • Event date
    • Category
    • Event
    • Record count

Additionally, we add a filter to annotations sheet to exclude draft lines.



Combo chart configuration for sessions time series

Now, we create a time series chart using a combo chart type, respecting the following configuration:

  • Data tab
    • Data source: Fresh blended data described above
    • Dimension : Date (Google Analytics date)
    • Metrics
      • Sessions (from Google Analytics)
      • Annotations “Record count” renamed as “Annotations”
    • Sort: Date ascending
    • Interactions: Turn on “Apply filter” option
      (when we click on a specific date, the list of annotations below will be filtered)
  • Style tab
    • Series #1 (sessions) with line using strong color (orange in the example), on the left Y-axis
    • Series #2 (annotations) with light-colored bars (blue in the example), on right Y-axis
    • Right Y-Axis: Set the Axis max to 1 to get the same bar height when one or more annotations exist for a date
    • Turn on the legend
    • Do not show chart header

To hide right Y-axis, we can also add a background-colored rectangle element over the combo chart.



Table chart configuration for filterable annotations list

The next step is to add a table chart listing dates annotations, with the following parameters of configuration:

  • Data tab
    • Data source: Our blended data again
    • Dimensions: Event date, Category and event
    • No metric
    • Sort by Event date ascending
    • Add table filter excluding lines without annotation: Exclude when “Event” Is Null (because the left joined blended data are based on GA data)
  • Style tab
    • For color consistency, use the same light color for header background than annotations in the combo chart (blue in the example)
    • Table body: Wrap text to allow it from Google Sheets (including list in the same cell)
    • Switch off footer pagination
    • Do not show chart header
  • Group combo chart with annotations table to ensure filtering only on annotations table and not on all page elements


Ting! Voilà! It’s ready. Bon appétit!


Inspiration for column chart

For this article, I was inspired and I adapt a very good idea from Data Runs Deep : Display annotations using column chart inside a Data Studio combo chart for time series purposes. Damion Brown’s agency uses to share very inspiring articles. You should definitely follow it.

Edit of the 4th of April:
Lee Hurst wrote also about another solution based on calculated fields created inside your main data source to add annotation comments with CASE WHEN statement following dates values. You will find all details in his amazing book “Hands On With Google Data Studio” – page 367. A must read if you decide to jump into Google Data Studio.


Final thoughts: Annotations finder & other articles

As an absolute source of information without correlation with any statistics except dates, reader can need to find specific event inside the report. So, we can imagine to add a specific page with all Google Data Studio annotations and related search engine, composed of a collection of filter controls. Advanced search inside Google Data Studio is another subject, the kind of subject I will probably write about in an incoming article. 😉

At last, if you need more ideas about how to provide data context inside your report, your can read an article describing solutions to provide data context and another proposing a reading custom helpers with switch, for a better understanding of your report by other users.


J’en prends note et je m’en félicite