How to connect Tableau to Google Analytics
Marketeers often don't realise they can build their own custom Google Analytics dashboards in Tableau and share them across the business.
- The Google Analytics connector queries the GA API rather than a database, so you pick dimensions and measures through a form-like interface and you're limited to seven dimensions and ten measures per query.
- Match the account, property and view exactly to what's in Google Analytics, otherwise your numbers won't line up — and always validate figures (e.g. page views per page) against the GA interface.
- Measure groups like 'page usage' automatically pull in the typical metrics for that area, saving you from knowing every measure name.
- API data sources require an extract — you can't connect live — but publishing to Tableau Server/Online lets you set a scheduled refresh.
- Once published, the data source can be reused across the organisation, connected to in Tableau Prep, and blended with other sources such as social media data.
- What we'll cover0:00
- Authenticating with your Google account0:51
- Choosing account, property and view1:40
- Selecting dimensions and measures4:17
- Extracting and building a view5:56
- Validating numbers against Google Analytics7:34
- Publishing the data source to Tableau Online9:21
- Scheduling and running the refresh10:41
- Reusing the data source and wrap-up13:02
0:00Hey, Tim here and in today's video I'm
0:01going to be taking you through how to
0:03connect to Google
0:04Analytics in Tableau Desktop. The Google
0:07Analytics Connector has actually been
0:08available for some
0:09time but it's one of those data sets where
0:11sometimes marketeers aren't actually aware
0:13that they can build their own custom
0:15analytics in Tableau and share those to the
0:17organization so
0:18others can also start using this data in a
0:20more flexible way. Now throughout this
0:22video I'm going
0:23to be switching between Tableau Desktop and
0:25Google Analytics itself so if you're
0:26following along
0:27it's useful to actually have a Google
0:29Analytics account so you can log in and see
0:31what it looks
0:32like on your own system and then when we
0:34build a view at the very end of this video
0:36you'll actually
0:36be able to contrast and compare and make
0:38sure everything is working correctly. The
0:40last thing
0:40we'll do is also publish the data source
0:42that we've created up to Tableau Server or
0:44in this
0:45case Tableau Online so that other people in
0:47the business can essentially share this
0:49data source.
0:50Okay let's jump into Tableau Desktop.
0:54The Google Analytics Connector is actually
0:56here on the left hand side for me because I
0:58used it
0:58more recently but if you can't see it here
1:00in the list of server connections just
1:02click more and
1:03you'll see a much larger list. I'm on a Mac
1:05so I don't see as many as Windows users but
1:07you can see
1:08here Google Analytics is in and amongst all
1:10the other Google Connectors. When you click
1:13on that
1:13you actually get this interface that asks
1:15you to log into a Google account that's
1:17essentially
1:17because the Google Analytics account is
1:19typically linked to a Google email so you
1:21need to make sure
1:22you connect to the correct email that will
1:24give you access to that Google Analytics
1:26account.
1:27In this case I have my own email for my
1:29blog so I'll just click on that and once I
1:33give it
1:34permission it authenticates you and you're
1:37now able to close this tab and head over to
1:39Tableau
1:40Desktop. Now we're in Tableau Desktop and
1:42you can see something immediately different
1:45. This doesn't
1:46look the same like a typical Connector in
1:47Tableau because it's not working like a
1:49database.
1:50Essentially this is connecting to the
1:52Google Analytics API and querying the data
1:54for you. So
1:55what you have here is a form-like
1:56experience to choose what part of your
1:58Google data you want to
2:00bring in. Now these particular filters are
2:02actually exactly the same as you'd see in
2:05Google. For
2:06example the account, the property in view
2:08can be viewed over here in Google Analytics
2:11. When I go to
2:12the top you can see that I have my account
2:14which in this case is just this single
2:16account Tableau
2:17data. I have two properties. One of those
2:20is my YouTube channel. I can actually track
2:22how people
2:23browse my YouTube channel and then the
2:24second is my blog where I actually track
2:27who follows my blog
2:28and who's visiting my blog. And then in
2:30each property or app I then have views.
2:33Views are
2:34essentially like tables in a database. So
2:36in this particular case I have just one
2:39view with all
2:39website data but you can actually see here
2:42that I built a separate view that singled
2:44out traffic
2:45from my own specific IP address. But that's
2:47now deleted so you can see that it's
2:49crossed out.
2:50So I shouldn't see this in Tableau when I
2:52connect. Let's head over back to Tableau.
2:54You'll see here
2:55in Tableau you've got the exact same list.
2:57The account, the property and the view. And
3:00you notice
3:00here that I can see both accounts available
3:02to me here. And essentially you need to
3:04make sure you
3:04choose the right one otherwise the numbers
3:06aren't going to match. I'm interested in
3:08looking at my
3:09blog and not my YouTube channel. So let's
3:11select that. And then the last thing is to
3:13choose a date
3:14range. Now this is an interesting field
3:16because you can download all your data but
3:18if the data
3:19set is too large for the API limits then
3:21you will only return a sample of your data.
3:24I don't actually
3:25have enough website traffic on my blog to
3:28actually trigger the sampling. But
3:31essentially if you head
3:32over to the Tableau documentation there's
3:34actually a really good article here that
3:36sort of shows you
3:37how to troubleshoot that specific scenario.
3:40You should essentially see this sort of
3:42warning here
3:43that says what the query returns. But at
3:45the same time as you build this view this
3:47might change
3:48depending on what you're asking Google to
3:50bring in. So you might not see this right
3:53at the beginning
3:54and you might see it right at the end
3:55before you switch over to a sheet and build
3:57a view.
3:57So we're going to make sure we watch out
3:59for this as we go along and we're going to
4:00sort of
4:00interrogate it in more detail. But I'll put
4:03a link to this knowledge base article so
4:04you can come here
4:05and troubleshoot any issues you might be
4:07having with bringing all the data that you
4:09need into
4:09Google Analytics. Okay let's switch over
4:12back to Tableau desktop and now we're back
4:15let's continue
4:16building our view. I'm just going to take
4:18the last 30 days and you'll see here that I
4:21get the ability
4:22to select certain dimensions. Now a useful
4:24dimension would be the page that a user is
4:27visiting.
4:27So let's just type in page and you'll see
4:29that this list dynamically searches through
4:32all the
4:32different dimensions possible inside of the
4:34Google Analytics tracking database and you
4:36can essentially
4:37just pick the ones that you need. So I'm
4:39going to bring through the page and the
4:41page title.
4:41And now that I've got those two you can
4:48actually see what's happening here. You're
4:51essentially
4:51almost selecting the dimensions and
4:53measures that you need. Now you don't have
4:55to know the measures
4:56that you need off the top of your head. I
4:59know a couple that I use quite a lot but
5:01there are
5:01actually these measure groups. Essentially
5:03if you choose one of these domain areas it
5:05will
5:05automatically bring in certain measures on
5:08your behalf. So let's look at page usage.
5:11When I select
5:12that it goes ahead and actually pulls
5:14through the typical metrics used to analyze
5:17page usage.
5:18Now the thing to bear in mind here is that
5:21you're limited to seven dimensions and 10
5:24measures.
5:25So think very wisely about what you're
5:26trying to analyze. I kind of like this
5:28because it forces you
5:29to focus your analysis. But if this
5:31restriction isn't ideal for you then there
5:34are a couple of
5:35ways you can kind of work around this but
5:37you really have to put a lot of thought
5:39into which
5:40subsets of your data that you're getting
5:42and making sure that if you get multiple
5:44subsets
5:45that they're at the same level of detail. I
5:48'm going to go ahead and add country to this
5:50dimension list.
5:51And now I think I'm ready to hop into Table
5:56au and start analyzing this data. In order
6:01to do that
6:01you just need to go over to Sheet1. You'll
6:04notice that all API data sources typically
6:07require you
6:08to have an extract. So I can't connect to
6:10this data live. I can however set this data
6:13source
6:13to refresh if I publish it up to the Table
6:15au server. So the best thing to do here is
6:17to go
6:18ahead with the extract, select Sheet1 and
6:21it will query the data from the API and you
6:24'll see that
6:25we're now in Tableau ready to go. Okay we
6:27're now in Tableau so this is the familiar
6:30view that we're
6:31used to. We can just go ahead and check
6:33that everything is working okay. I'm going
6:35to go ahead
6:36and grab the page title. This is actually
6:38quite useful because these are the titles
6:40that the page
6:40themselves have and you can actually see
6:42all the different pages that have actually
6:44been visited
6:45on my blog. If I go ahead and bring the
6:48page views you can quickly get a sense of
6:51whether this data
6:51set is actually making sense or not and you
6:53can start to see here that you know this
6:55this looks
6:56about right. The more meaningful item to
6:59bring here might just be the page because I
7:01think this
7:02is just the page as it is on the URL and I
7:04sometimes find it weird but this is
7:06actually
7:07easy for me to understand because it means
7:09that I can actually go to this page
7:11directly and see that
7:12more clearly and so I know that this
7:14forward slash is essentially always my home
7:16page because you can
7:17essentially add TableauTim.com forward
7:19slash and then when there's nothing after
7:21that that's just
7:22a home page. So I can see here that my home
7:25page got 200 page views. Now the critical
7:28thing is
7:29making sure that this actually lines up
7:30with what we're seeing in Google Analytics
7:33itself. So let's
7:33go ahead and just validate that. I'm
7:36switching over to Google Analytics here and
7:39in order to go
7:40see the same view you need to make sure
7:42that you're setting the filters to the same
7:44sort of
7:45metrics. I'm going to go over to behavior
7:47then I'm going to select site content and
7:50then I'm going to
7:50go to all pages. This is where Google shows
7:53you how it's tracking all website pages and
7:56you can
7:56actually see here that the forward slash
7:59also has 200 page views. The next biggest
8:02page has 139.
8:04It's my blog post on sketchnoting so let's
8:06go back to Tableau Desktop and validate
8:08that that's the same.
8:09I also get sketchnoting as the second most
8:12popular view and again I have 139. So in
8:16this particular
8:17context everything is lined up and
8:19everything is validating and working
8:20correctly. Now there are
8:23sometimes quirks when you won't see the
8:25correct number compared to what's in Google
8:28Analytics and
8:29this can can sort of be a challenge because
8:31what you need to make sure you understand
8:34is the level of detail that Google
8:36Analytics is showing you in the view that
8:38you're looking at and
8:40that essentially comes with experience and
8:42understanding of Google Analytics and also
8:44Tableau because you need to be working with
8:46the dimensions and measures that you've
8:48brought in.
8:48Now I can go ahead and break these down by
8:53a particular country so I'm just going to
8:54keep
8:54the home page and I just want to understand
8:57which country visits my home page the most.
9:00So it's United States right at the top on
9:0351 followed by India. Big shout out to all
9:06the
9:06Indian fans who follow my blog and then the
9:09United Kingdom close after that at 28. Then
9:12you've got a
9:12long list of other countries sort of below
9:15but it's awesome to see this data here and
9:18you can
9:18start to see how this is really exciting
9:20and a great use case for Tableau. Now the
9:22next thing
9:23we're going to do is publish this data
9:24source up to Tableau server so that other
9:26users can use this
9:27to build their own view. In order to do
9:30that we're just going to right click the
9:31data source and
9:32select publish to server. When we do that I
9:35'm already logged into my Tableau server so
9:38you'll
9:39actually get this interface straight away
9:40but if it's not in the right place or you
9:42want to move
9:43the server that it's publishing to sign out
9:45of the server and sign back into the
9:46correct one
9:47and then go ahead and choose your project.
9:50I'm going to leave everything as is because
9:52I'm just
9:52going to publish this straight up but the
9:54first thing I'm going to do before I do
9:56that is just to
9:57check the authentication. I'm going to
9:59click edit. I'm actually going to enable
10:01refreshers on this
10:02particular data source so I'm going to
10:04select this option here and when I do that
10:06when I go to
10:07publish it will actually ask me to authent
10:09icate again because this time around I'm
10:11actually
10:12authenticating on behalf of the Tableau
10:14server so that it can go and get data on my
10:16behalf
10:17based on a refresh schedule that I set. I'm
10:20going to hit publish
10:21and when this finishes it will publish
10:25right up to Tableau online. Now you didn't
10:30see it ask me for
10:31validation because I was actually already
10:33logged in so just be aware that you might
10:35see that login
10:36page again to authenticate your Google
10:38account. I'm going to select schedule. We
10:41're going to
10:41schedule this straight away and I'm
10:43actually going to set it to refresh every
10:45six hours. That's about
10:47as frequent as I'd actually want to look at
10:49Google analytics data. If I want more
10:51frequent data then
10:52I'd probably just go to the Google
10:54analytics page itself so the dashboard
10:55should really only reflect
10:57sort of midday and daily changes. So let's
10:59schedule that refresh and now you'll see
11:03that
11:03my data source is now published to Tableau
11:05server. I can of course edit the
11:07permissions on this data
11:09set and add people and allow others to
11:11connect to it just like I can with any
11:13other data set
11:14but I'm now democratizing this data across
11:16my organization and other people who want
11:18to use
11:19it in their dashboards can. Now the next
11:21thing you might want to see is this
11:24particular data
11:25source refreshing. I'm going to go ahead
11:27here to the extract refreshes tab and you
11:30can see here
11:30that I actually have one set up. I set this
11:33up when I published it but I can trigger
11:34this right
11:35now by just clicking these three dots and
11:38selecting run now. When I hit run now this
11:42creates a task
11:43that is then scheduled to run. If I go over
11:46to tasks you'll see that I have my refresh
11:50here.
11:50This is the every six hour refresh but the
11:53task I just set off now is actually in the
11:56jobs list.
11:57So you can see here that it's pending. It's
11:59this top job over here. Now I actually ran
12:01one earlier
12:02on but you're not actually able to see the
12:03details of the job because that only hangs
12:05around for a
12:06few minutes after the job is complete. So
12:08we're going to wait here and just look at
12:10the information
12:11of the run. It looks a little something
12:13like this and essentially this queue time
12:15shows you how long
12:16it's going to be waiting in the queue. So
12:18it might be 11 minutes before this data is
12:20refreshed. So
12:21I'm just going to pause this video. I'm
12:23going to let this complete and then we'll
12:24come back and
12:25check the data is up to date. Okay that
12:29actually finished much much faster. This
12:32time it only queued
12:33for 0.7 minutes. Basically you know seven
12:37tenths of a minute whatever that is. I can
12:39't do the maths
12:40in my head. But you can see here that the
12:43task is complete. This was successfully run
12:46and this is
12:47and has successfully updated. And so our
12:50data source is now up to date and users can
12:52actually
12:53start using this particular data source and
12:57engaging with it and even using it in
12:59places
13:00like ask data to build their own views and
13:02ask very very simple questions. So that's
13:05how you
13:06connect to Google Analytics and publish
13:08that data source up to your Tableau server
13:10so other people
13:11can use it. In future videos I'll show you
13:13how to build more advanced views with
13:15Google Analytics
13:16and for those of you who are wondering how
13:18you can get Google Analytics data into data
13:20prep tools,
13:21once published to Tableau server you can
13:23actually connect to it using Tableau prep
13:26because all
13:26published data sources can actually be
13:28connected to using Tableau prep. So you can
13:31actually even
13:32start to blend this data alongside other
13:34data like social media data that might be
13:36coming in
13:36from another data set into one central
13:39source. Okay you can see here that ask data
13:43isn't available
13:44but thanks for watching. Tune in for the
13:46next video and I hope to see you soon. If
13:49you've liked
13:49this video hit the like button, if not drop
13:51a comment below let me know what you'd like
13:53to see,
13:53what you'd like to see improved, maybe
13:55something I didn't cover something, let me
13:57know what that is
13:58and we'll try and address it in another
14:00video. All right I'll catch you in the next
14:02one.
14:03[Music]
In this video, I walk through how to connect to Google analytics, covering how to choose the correct account properties and segments, and then Validate the data is correct in desktop. I also show how to publish up the data source to Tableau Server or Tableau Online and set up a daily refresh on google analytics so the data stays fresh and colleagues can use it to augment their insights.Tableau Documentation: https://help.tableau.com/current/pro/desktop/en-us/examples\_googleanalytics.htm Timestamps: 0:00 Introduction0:56 Connect to Google analytics.1:40 The connection interface and selecting your Google analytics data.4:20 Choosing your dimensions and measures/metrics and dimensions from Google analytics.6:20 Check your data in Tableau9:20 Publish Google Analytics to Tableau Server as a data source and enable refreshes. 10:00 Schedule you refresh#tableau #google #googleanalytics #salesforce ----Join my Discord Server. https://discord.gg/shBuxXr it’s a little sparse at the moment but hang in there.