4 EASY Steps to create a Google Analytics Glossary

Hello, data enthusiasts!

Ever been in a meeting where you’re asked to explain a certain metric on a Google Analytics (GA) chart and wished you had a handy guide at your fingertips? Or perhaps a superior has asked you about a specific dimension during a presentation and you’ve had to take a wild guess? We’ve all been there!    

That’s where a GA Data Dictionary comes into play – it’s the ultimate tool to have in your analytics toolkit. Every team or org should have a Data Dictionary in their arsenal.  It’s a comprehensive guide to ALL metrics and dimensions in GA, offering a single source of truth. No more guesswork, no more confusion – just clear, consistent data interpretation.

Sounds good, right? Well, it gets better! Creating your own GA Data Dictionary is as simple as 1, 2, 3…4!  Let’s go through the process using Python, a notebook, and the Google Analytics Metadata API.

Step 1: Prep Your Python Environment

Begin by ensuring Python is ready to roll on your system. If not, head over to the official Python website to download the latest version. With Python set, open a new Python notebook and import the `requests` library – our gateway to the Google Analytics Metadata API.

import requests

Step 2: Connect to the Google Analytics Metadata API

Next, we’ll tap into the Google Analytics Metadata API, a treasure trove of GA dimensions and metrics.

url = “https://www.googleapis.com/analytics/v3/metadata/ga/columns”

response = requests.get(url)

data = response.json()

Step 3: Organize Your Data

With the data in hand, it’s time to make sense of it. We’ll extract three key pieces: the IDs, the names, and the descriptions of the metrics and dimensions.

data_dict = []

for item in data[‘items’]:

    id = item[‘id’]

    name = item[‘attributes’][‘uiName’]

    description = item[‘attributes’][‘description’]

    data_dict.append([id, name, description])

Step 4: Build Your Data Dictionary

Last but not least, we’ll transform our data into a user-friendly format using a pandas DataFrame. We can then export this DataFrame as a CSV file – and voila, your very own GA Data Dictionary!

import pandas as pd  

df = pd.DataFrame(data_dict, columns=[“ID”, “Name”, “Description”]) df.to_csv(‘GA_Data_Dictionary.csv’, index=False)

Congratulations! You’ve just built your very own Google Analytics Data Dictionary in 4 simple steps. With this powerful tool, you’ll have clarity and confidence in every data discussion. So, go ahead, impress your team with your newfound data prowess!



Most Popular Posts


Subscribe and get the latest updates directly from our newsroom.