[Estimated read time: 13 minutes]
With today’s blog post I’m sharing everything one needs to know about an underappreciated tool: the Google Analytics add-on for Google Sheets. In this post I’ll be covering the following:
1. What is the Google Analytics add-on?
2. How to install and set up the Google Analytics add-on.
3. How to create a custom report with the Google Analytics add-on.
4. A step-by-step worked example of setting up an automated report.
5. Further considerations and pitfalls to avoid.
Thanks to Moz for having me, and for giving me the chance to write about this simple and powerful tool!
1. What is the Google Analytics add-on and why should I care?
I’m glad I asked. Simply put, the Google Analytics add-on is an extension for Google Sheets that allows you to create custom reports within Sheets. The add-on works by linking up to an existing Analytics account, using Google’s Analytics API and Regular Expressions to filter the data you want to pull, and finally gathering the data into an easy and intuitive format that’s ripe for reporting.
The Google Analytics add-on’s real value-add to a reporting workflow is that it’s extremely flexible, reliable, and a real time-saver. Your reporting will still be constrained by the limitations of Sheets itself (as compared to, say, Excel), but the Sheets framework has served almost every reporting need I’ve come across to date and the same will probably be true for most of you!
In a nutshell, the Add-On allows you to:
- Pull any data that you’d be able to access in the Analytics API (i.e analytics.google.com) directly into a spreadsheet
- Easily compare historical data across time periods
- Filter and segment your data
- Automate regular reporting
- Make tweaks to existing reports to get new data (no more re-inventing wheels!)
If this all sounds like you could use it, read on!
2. Getting started: How to install and set up the Google Analytics add-on
2A. Installing the Google Analytics add-on
- Go into Google Sheets.
- On the header bar, under your Workbook’s title, click add-on.
- This opens a drop-down menu — click “Get add-ons.”
- In the following window, type “Google Analytics" into the search bar on the top right and hit enter.
- The first result is the add-on we want, so go ahead and install it.
- Refresh your page and confirm the add-on is installed by clicking “Add-ons” again. You should see an option for “Google Analytics.”
That’s all there is to installation!
2B. Setting up the Google Analytics add-on
Now that we have the Google Analytics add-on installed, we need to set it up by linking it to an Analytics account before we can use it.
- Under the “Add-ons” tab in Sheets, hover “Google Analytics” to expose a side-bar as shown below.
- Click “Create New Report.” You’ll see a menu appear on the right side of your screen.
- In this menu, set the account information to the Analytics account you want to measure.
- Fill out the metrics and dimensions you want to analyze. You can further customize segmentation within the report itself later, so just choose a simple set for now.
- Click “Create Report.” The output will be a new sheet, with a report configuration that looks like this:
- Note: This is NOT your report. This is the setup configuration for you to let the add-on know exactly what information you’d like to see in the report.
Once you’ve arrived at this step, your set-up phase is done!
Next we’ll look at what these parameters mean, and how to customize them to tailor the data you receive.
3. Creating a custom report with the Google Analytics add-on
So now you have all these weird boxes and you’re probably wondering what you need to fill out and what you don’t.
Before we get into that, let’s take a look at what happens if you don’t fill out anything additional, and just run the report from here.
To run a configured report, click back into the “Add-Ons” menu and go to Google Analytics. From there, click “Run Reports.” Make sure you have your configuration sheet open when you do this!
You’ll get a notification that the report was either successfully created, or that something went wrong (this might require some troubleshooting).
Following the example above, your output will look something like this:
This is your actual report. Hooray! So what are we actually seeing? Let’s go back to the “Report Configuration” sheet to find out.
The report configuration:
Type and View ID are defaults that don’t need to be changed. Report Name is what you want your report to be called, and will be the name generated for the report sheet created when you run your reports.
So really, in the report configuration above, all the input we’re seeing is:
- Last N Days = 7
- Metrics = ga:users
In other words, this report shows the total number of sessions in the specified View ID over the last week. Interesting maybe, but not that helpful. Let’s see what happens if we make a few changes.
I’ve changed Last N Days from 7 to 30, and added Date as a Dimension. Running the report again yields the following output:
By increasing the range of data pulled from last 7 to 30 days, we get a data from a larger set of days. By adding date as a dimension, we can see how much traffic the site registered each day.
This is only scratching the surface of what the Google Analytics add-on can do. Here’s a breakdown of the parameters, and how to use them:
Parameter Name |
Required? |
Description & Notes |
Example Value(s) |
---|---|---|---|
Report Name |
No |
The name of your report. This will be the name of the report sheet that's generated when you run reports. If you’re running multiple reports, and want to exclude one without deleting its configuration setup, delete the report name and the column will be ignored next time you run your reports. |
“January Organic Traffic” |
Type |
No |
Inputs are either “core” or “mcf,” representative of Google’s Core Reporting API and Multi-Channel Funnels API respectively. Core is the default and will serve most of your needs! |
“core” / “mcf” |
View (Profile) ID |
Yes |
The Analytics view that your report will pull data from. You can find your view ID in the Analytics interface, under the Admin tab. |
ga:12345678 |
Start / End Date |
No |
Used alternatively with Last N Days (i.e you must use exactly one), allows you to specify a range of data to pull from. |
2/1/2016 – 2/31/2016 |
Last N Days |
No |
Used alternatively with Start / End Date (i.e you must use exactly one), pulls data from the last N days from the current date. Counts backwards from the current date. |
Any integer |
Metrics |
Yes |
Metrics you want to pull. You can include multiple metrics per report. Documentation on Metrics and dimensions can be found in Google’s Metrics & Dimensions Explorer |
“ga:sessions” |
Dimensions |
No |
Dimensions you want your metrics to be segmented by. You can include multiple dimensions per report. Documentation on metrics and dimensions can be found here. |
“ga:date” |
Sort |
No |
Specifies an order to return your data by, can be used to organize data before generating a report. Note: you can only sort by metrics/dimensions that are included in your report. |
|
Filters |
No |
Filter the data included in your report based on any dimension (not just those included in the report). |
“ga:country==Japan; |
Segment |
No |
Use segments from the main reporting interface. |
“users::condition:: |
Sampling Level |
No |
Directs the level of sampling for the data you’re pulling. Analytics samples data by default, but the add-on can increase the precision of sampling usage. |
“HIGHER_PRECISION” |
Start Index |
No |
Shows results starting from the current index (default = 1, not 0). For use with Max Results, when you want to retrieve paginated data (e.g if you’re pulling 2,000 results, and want to get results 1,001 – 2,000). |
Integer |
Max Results |
No |
Default is 1,000, can be raised to 10,000. |
Integer up to 10,000 |
Spreadsheet URL |
No |
Sends your data to another spreadsheet. |
URL for sheet where you want data to be sent |
By using these parameters in concert, you can arrive at a customized report detailing exactly what you want. The best part is, once you’ve set up a report in your configuration sheet and confirmed the output is what you want, all you have to do to run it again is run your reports in the add-on! This makes regular reporting a breeze, while still bringing all the benefits of Sheets to bear.
Some important things to note and consider, when you’re setting up your configuration sheet:
- You can include multiple report configurations in the the sheet (see below):
In the image above, running the report configuration will produce four separate reports. You should NOT have one configuration sheet per report.
- Although you can have your reports generated in the same workbook as your configuration sheet, I recommend copying the data into another workbook or using the Spreadsheet URL parameter to do the same thing. Loading multiple reports in one workbook can create performance problems.
- You can schedule your reporting to run automatically by enabling scheduled reporting within the Google Analytics add-on. Note: this is only helpful if you are using “Last N Days” for your time parameter. If you’re using a date range, your report will just give you the same data for that range every month.
The regularity options are hourly, daily, weekly, and monthly.
4. Creating an automated report: A worked example
So now that we’ve installed, set up, and configured a report, next up is the big fish, the dream of anyone who’s had to do regular reporting: automation.
As an SEO, I use the Google Analytics add-on for this exact purpose for many of my clients. I’ll start by assuming you’ve installed and set up the add-on, and are ready to create a custom report configuration.
Step one: Outline a framework
Before we begin creating our report, it’s important we understand what we want to measure and how we want to measure it. For this example, let’s say we want to view organic traffic to a specific set of pages on our site from Chrome browsers and that we want to analyze the traffic month-over-month and year-over-year.
Step two: Understand your framework within the add-on
To get everything we want, we’ll use three separate reports: organic traffic in the past month (January 2016), organic traffic in the month before that (December 2015), and organic traffic in the past month, last year (January 2015). It’s possible to include this all in one report, but I recommend creating one report per date period, as it makes organizing your data and troubleshooting your configuration significantly easier.
Step three: Map your key elements to add-on parameters
Report One parameter breakdown:
Report Name – 1/1/2016
- Make it easily distinguishable from the other reports we’ll be running
Type – core
- The GA API default
View (Profile) ID
- The account we want to pull data from
Start Date – 1/1/2016
- The beginning date we want to pull data from
End Date – 1/31/2016
- The cutoff date for the data we want to pull
Metrics – ga:sessions
- We want to analyze sessions for this report
Dimensions – ga:date
- Allows us to see traffic the site received each day in the specified range
Filters – ga:medium==organic;ga:landingpagepath=@resources
- We’ve included two filters, one that specifies only organic traffic and another that specifies sessions that had a landing page with “resources” in the URL (resources is the subdirectory on Distilled’s website that houses our editorial content)
- Properly filling out filters and segments requires specific syntax, which you can find on Google’s Core Reporting API resources.
Segments – sessions::condition::ga:browser==Chrome
- Specifies that we only want session data from Chrome browsers
Sampling Level – HIGHER_PRECISION
- Specifies that we want to minimize sampling for this data set
Report One output: Past month’s sessions
Now that we’ve set up our report, it’s time to run it and check the results.
So, in the month of January 2016, the resources section on Distilled’s website saw 10,365 sessions that satisfied the following conditions:
- organic source/medium
- landing page containing “resources”
- Chrome browser
But how do we know this is accurate? It’s impossible to tell at face value, but you can reliably check accuracy of a report by looking at the analogous view in Google Analytics itself.
Confirming Report One data
Since the Google Analytics add-on is an analogue to what you find on analytics.google.com, in your account, we can combine separate pieces in GA to achieve the same effect as our report:
Date Range
Organic Source/Medium
Landing Page Path & Browser
The result
Hooray!
Now that we’ve confirmed our framework works, and is showing us what we want, creating our other two reports can be done by simply copying the configuration and making minor adjustments to the parameters.
Since we want a month-over-month comparison and a year-over-year comparison for the exact same data, all we have to do is change the date range for the two reports.
One should detail the month before (December 2015) and the other should detail the same month in the previous year (January 2015). We can run these reports immediately.
The results?
Total Sessions In January 2015 (Reporting Month, Previous Year: 2,608
Total Sessions In December 2015 (Previous Month): 7,765
Total Sessions In January 2016 (Reporting Month): 10,365
We’re up 33% month-over-month and 297% year-over-year. Not bad!
Every month, we can update the dates in the configuration. For example, next month we’ll be examining February 2016, compared to January 2016 and February 2015. Constructing a dashboard can be done in Sheets, as well, by creating an additional sheet that references the outputs from your reports!
5. Closing observations and pitfalls to avoid
The Google Analytics add-on probably isn’t the perfect reporting solution that all digital marketers yearn for. When I first discovered the Google Analytics add-on for Google Sheets, I was intimidated by its use of Regular Expressions and thought that you needed to be a syntax savant to make full use of the tool. Since then, I haven’t become any better at Regular Expressions, but I’ve come to realize that the Google Analytics add-on is versatile enough that it can add value to most reporting processes, without the need for deep technical fluency.
I was able to cobble together each of the reports I needed by testing, breaking, and researching different combinations of segments, filters, and frameworks and I encourage you to do the same! You’ll most likely be able to arrive at the exact report you need, given enough time and patience.
One last thing to note: the Google Analytics interface (i.e what you use when you access your analytics account online) has built-in safeguards to ensure that the data you see matches the reporting level you’ve chosen. For example, if I click into a session-level report (e.g landing pages), I’ll see mostly session-level metrics. Similarly, clicking into a page-level report will return page-level metrics. In the Google Analytics add-on, however, this safeguard doesn’t exist due to the add-on being designed for greater versatility. It’s therefore all the more important that you’re thorough in outlining, designing, and building your reporting framework within the add-on. After you’ve configured a custom report and successfully run it, be sure to check your results against the Google Analytics interface!
Abraham Lincoln famously said, “Give me six hours to chop down a tree and I will spend the first four sharpening the axe.” Good advice in general that also holds true for using the Google Analytics add-on for Google Sheets.
Supplementary resource appendix:
- Kristi Hines' Google Analytics for Beginners guide – See title.
- Google's Analytics Core Reporting API Documentation – Dig around here to find out how to build reports that give you exactly what you’re looking for!
- Avinash Kaushik's Analytics Resource – Discusses the Google Analytics reporting framework and how to think about metrics and sessions.
- RegExr – General Regular Expressions resource.
- Debuggex – Visual Regular Expressions debugging tool.
Hi Tian,
Thanks for this most, I read comments as well as your post. It seems, most of us were unaware of existence of such a useful add-on. This would be great help.
Thanks again !
Regards,
Vijay
I love the google analytics plug in. I use it create custom dashboards for leadership so that they don't have to go into Google Analytics, but they can always see current data.
A couple of things that I would add, if you have done some advanced segmentation in your Google analytics account, you can use those segments for your report. You will need to API ID for your Segment, the easiest way to access this is through Google Analytics Query Explorer. https://ga-dev-tools.appspot.com/query-explorer/. You can look up your segment by the name you saved it as and then copy the ID into the "Segment" row in your report configuration tab in Google Sheets.
Also, I recommend leveraging the custom date formulas within Google Sheets rather than hard dates to create a recurring reports. Some examples to get you started.
Great suggestions, thanks! I'm definitely going to include this in an update soon, I'll be sure to shout you out!
Really powerful tool. If you use Google Analytics and have to prepare reports for your clients for preseting results, this is the best way to construct your owne report, so you can combine in a spreadsheet some GA reports. Thanks for sharing.
Does anybody have any advice on custom filtering or links to good (idiot proof) guides. Or even an opinion on my approach?
We've been optimising pages for a client based on particular products. The main objectives for the client are to see an increase in traffic from search and to obviously acquire leads - so top level measures are easy enough to obtain.
I was wanting to measure the following: new users/sessions/bounce/exits/time for landing page path, segmented by organic, month on month but I wanted to filter to only see the landing pages that we have optimised. I believe there is a limit in the characters for regex in the API.
The reason for wanting to do this is to understand if we've chosen the right keywords, in theory by optimising the pages to receive an A grade (we use Moz) we've seen position in SERPs increase as has visibility and everything you'd associate. But we've only seen very small total increases in organic traffic, so by looking at the page I can see which pages have led to the improvement and which haven't.
Firstly is this a good way of measuring the improvement or is it too granular? Secondly has anybody tried similar but been stumped by the syntax required in the filters command of the API?
Thanks for the post - although I've known about the analytics add-on for a while, this is the clearest explanation of it I've ever read. A series on the add-on would be great.
Also for anyone looking to try a less scary version, check out Supermetrics, it's similar but has a prettier interface and connects to more sources (such as Moz, Facebook, search console) but be prepared to part with some cash if you want all of its features.
Super stoked about this! I've been playing with this for the last hour. I couldn't find a way to set the date range for automated reporting, so I figured out formulas to automatically pull the first and last date of the previous month:
First date of previous month: =EOMONTH(today(),-2)+1
Last date of previous month: =EOMONTH(today(),-1)
With these in place, when you automate the report to run for previous month metrics, you don't need to update the date range.
Excited to find other ways to reduce reporting squirrel time!
I've only just started using Google sheets recently as Drive is so convenient for taking work home without having to dropbox it or email myself excel sheets.
Really starting to see some more additional benefits and using some other addons on the sheets too although I saw this addon I didn't have time to dig in and work out how to use it so, this post has been a real god send, along with your formula I should be cooking on Gas in no time :)
Cheers Tian and Logan, thumbs up to you both :)
What a good post Tian! I didn't know of the Google Analytics Add-on for sheets existance but it seems so useful when it comes to automated reports, it saves you plenty of time! And with all the instructions it seems to be so easy, thank you :).
I'm going to use it too!
Thanks!! I wanted to share this tool with the community because it's versatile and relatively straightforward to use. I'm still learning about the tool myself, so I can't wait to see what everyone comes up with :)
For those of you needing a formula to dynamically enter in dates for month-over-month data comparisons, here you go:
Last Month Report
Previous Month
I spent a bit of time getting this to work without having to worry about it breaking when a new year starts. Hope it is of use to someone!
I can honestly say I never knew this add-on existed. I set it up for a blog I write for that gets 2 million sessions a month, so I could better track what posts were doing well and what not. It's an amazingly simply add-on, though it does take some time to research the correct variables to help sort and feature things the exact way you want.
Thank you for this post! :)
Hi Tian,
It's happen many times that we are using lots of tool but we are not know very much about it, like we can take example of this post "The Google Analytics Add On for Sheets", many of us using this tool and many totally unaware of this tool but after reading this post we realize that what have been missing by us. I also feel same kind of thing, Thanks for this elaborated post.
Our marketing team use GA reports almost every day, with this tool it will be easier to make our own reports. Thanks for sharing, I didn't know about this possibility
Wow, thanks for this cool article! I've been using this extension for several months by now, and I can definitely say I love it!
Still I haven't found a solution for the report I need, maybe you can give a hint? I wanted to make a report where on Y axis I have a number of landing pages and on X axis I have calendar date.
Hi Tian.
I find Google Analytics
Very hard to read
It is not at all
User friendly.
Great post.
Regards.
Great article!
If anyone is having issues with their report data in Google Sheets not matching their numbers in Google Analytics try changing the "Type" configuration in your sheets report from 'core' to 'mfc'. I was working on trying to get our numbers to match for a couple days and this small change made all the difference.
Thanks for sharing this helpful article. gone through the article and found very helpful.
I have my site Eduonix learning solution and I can't fectch some of the data in my GA. Is there any solution how to get the right track of the site.
Thanks and regards,
Paddy
Hi Paddy,
Have you searched our Q&A Forum? You may find an answer to a question there (from someone with a similar issue) that points you in the right direction. Best of luck to you!
Christy
Thanks for the information. I am searching for details on how to deal with Google Analytics and this post of yours really helps a lot.
I have a web site - https://tokohappy2.com - that is already quite old and has been only partially entered SERP no one other index does not know where put there by Google, can be helped?
That's a great question to ask in our Q&A forum!
Hi Tian,
Thanks for sharing this post. I have used this Google Analytics addon for GSheet, However, I have faced the biggest challenge is about the formatting issues, Is there any way how I can get the perfect formatting with the help of this addon?
That looks like a great plugin. I've always found it tedious to manipulate data, but I'll give this a shot as it looks awesome. Thanks for the post.
Any idea how to compare the same metric/ dimension in two different time periods. So like users over the past 7 days to the 7 days prior.
You will want to set two different reports to run for the time periods you want to compare. I commented a few weeks ago giving an example of Month-over-Month start and end dates. You would want to do similar formulas to update the start and end dates of each report to return the desired range.
Awesome Article, thanks for sharing
Honestly: I think I prefer the standard reports, nice to know that you can do the above though so thnaks.
Tian Wang, really a good read. I know about Google Analytics but was not aware of Google Analytics add-on. This is really important to know about this and the benefits of the google sheets. I will definitely try out the steps to create customized reports. Thank you for your time sharing this with us.
Hi Tian
Without any doubt, GA is an indispensable tool for anyone working within the online marketing environment. The job almost every day and always learn something new. And with this post I think I've been pretty
Thank you very much for the post
Thanks for sharing informative article. Really its very helpful to create customized report.
Hi Tian, superb article! Congrats!
I’m Jonatan, co-founder of Import Sheet, I just want to make an addendum... I wrote a post about how to create a automatic historic record by freezing and appending data generated by Google Analytics add-on, using Import Sheet. It may be interesting for those who want to analyze daily without doing manual work: https://importsheet.com/automate-record-google-analytics-reporting-google-sheets/
Thank you!
Interesting article, every day I learn more new things in this blog, I hope to follow your concerns and take into account all the knowledge put into this article, thank you very much
Thanks for all the information will be very useful to me
Nice infomation, I am using this add on from last one year but so many new feature, I can learn from this post thanks Tian Wang for a such a informative post on Google Analytics Add-On.... Most Important is we can get In Page Analytics....Mean's we can get a single page traffic from our browser if we install the GA In-page Analytics Add On Also..
I've come across tools like this in the past but inevitably they stop working 3 months, 6 months, 1 year later - and all your reporting & such is tied up on a broken system.
Is there a way to "save" a copy of the add ons? How do you ensure it doesn't break all your reports in 6 months when the person who created it removes it or changes how it works. Or Google changes and the add-on author doesn't maintain and it breaks?
This kind of legacy stuff didn't bother me at first but the more I've grown businesses, the more I realize I want to use the same systems in a couple years as I setup now or all that "time saved" goes right back into "time wasted setting up a new solution."
Great post. Thank you gor sharing.
I really like this post. I have a report for every client set up, where I can check all the relevant data in the morning. I work a lot with custom segments and they can be used here as well.
For me this URL helped a lot to get the custom segment ID → https://developers.google.com/analytics/devguides/...
:)
I'm gonna try this Add-on cause it seems to be easy to use.
Great post for a great tool!
I use this to create reports for clients that need that always what info.
I create charts from the data and create a Google site were I embed the charts and set the reports to run daily or hourly so they get there data and don't email/call me
Hi luckyboost!
I do the exact same thing, there was a great article written awhile back on it (I cant find it at the moment) that was a step by step and really helped me get started. Then I dove into Google developer and that's when I got carried away (haha) but clients love the custom dashboards and automated reports!
you can find 2 great videos tacking you step by step on Google developers blog Google Analytics Spreadsheet Add-on
I have been using this tool for a year now and it works really great. Specially I can share the google sheet with my team and there is no need to share the complete analytic account.
This is a great tool, our team has also used it in the past. The only downside is that it works for a single Analytics account only. Doesn anyone know a similar tool that collects data from multiple accounts?
Check out Supermetrics.
Tian this is very helpful resource i must say. As i am Google analytics lover & this post makes me fall more into GA.
Appreciated & much more thanks for this post!
It's been surprising for me how many people have no idea this tool existed. Even more surprising why Google is not promoting this more actively. It's excellent tool in your analytics arsenal.
I have used Google Analytics but I was not aware of an add-on for it. I am going to give it a try. Great article!
This addon is super helpful when you use custom variables in your analytics code. I have created reports that use some very specific user level statistics, and when you import them to sheets, you have tons of control to craft the reports you need. Super highly recommend this addon.
Also, side note - the google sheets community is literally the most helpful bunch on the web. I think its almost a competition for them to see who can help the best, the fastest. So if you need to do tons of creative data manipulation, google sheets is def the place to do it.
I was just experimenting with this today, so I was super excited to see that there was a new MOZ post on this! When filtering on a range (i.e. month), I am seeing some conflicting data with GA for "sessions". It seems the sessions data pulled into Google spreadsheets seems slightly higher than what is showing up with GA for the same timeframe. Any thoughts on why this would be different? I'm sure it would confuse clients if it confuses me. :P
Excellent article thanks for all the info!
This tool seems really great, I have it installed and have run a few sample reports. I see the value in not having to go through Analytics to get the data I need, but I'm not sure when this would actually be the most useful.
Does anyone have any examples of when to run reports through this tool, and what type of reports you find easiest to run here?
I'm using it to automate monthly reporting. I've got a report setup to run at the beginning of each month, it pulls the previous months metrics and drops the data into a spreadsheet formatted just like the Excel sheet I used to manually update each month. Took a while to setup and definitely not the easiest, but now I don't have to pull that data each month.
I use it to find very specific things such as new users on a particular set of landing pages within a period compared to a period.
Although possible in Analytics, I found I was turning segments on and applying secondary dimensions, entering advanced search parameters and getting very messy tables of data. Then having to repeat this for every page. It was taking me hours each time but once set up in the add-on it's just a click of a button.
I use to automize all of my marketing indicators that depended on outputs from Google Analytics, like this example that I wrote in my blog: https://importsheet.com/automate-record-google-analytics-reporting-google-sheets/
Can't say I've ever come across it before. Thanks for the info.
Great article. Thanks for the valuable information.
That's sounds like an awesome idea. Will for sure give it a try. Thanks for sharing.