We can create informative reports on our website analytics using Tableau. Tableau has the ability to connect to a Google Analytics data source. The problem is that if Tableau cannot pass the credentials to Google automatically, the following error message pops up.
“An error occurred when publishing the data source. GetOAuthUsername caught exception processing specs. Response code: 500”
So, how we can publish a Google Analytics data source into a Tableau sever? How we can publish created Tableau worksheets that are linked to a Google Analytics data source into the Tableau server? Why the above error message pops up and how we can resolve the problem? These and some more questions are going to be answered in the following post. But, first of all, how we can use Tableau to create reports based on Google Analytics data sources?
Open Tableau desktop and
1. Click on “Connect to data”
2. From “Connect to Data” pane click on “Google Analytics”
3. Enter the credentials and click “Sign in”
4. Accept the permissions that Tableau Desktop needs to connect to your Google account
5. Follow the steps below:
a. Choose an Account, Property and Profile
b. Select date range
c. Select dimensions and measures (up to 7 dimensions and 10 measures)
d. Give the connection a name for use in Tableau
e. If you want to sign in to another Google account just click on “Change Sign In…” button
f. Click OK
6. Now we can create a report for site visits per date. Name the worksheet as Google Analytics.
1. Right click on “Google Analytics” data source from the data pane and click “Publish to server”
2. Enter your Tableau credentials and click OK
3. Select the site that you want to publish the data source
4. Add the users that should see the worksheet and set their permissions by clicking on “Add…” button, then click “Publish”
5. Now, Tableau asks the following question “For this datasource to be scheduled for refresh on the Server, you must embed credentials. If you continue to publish without embedding credentials, this datasource will be removed from any existing schedules. Would you like to embed credentials now?” Here you if you click “Yes” the error message will pop up, so, for now just click “NO”.
1. In Tableau desktop, open “Server” menu and select “Publish Workbook”
2. Click “Publish”
3. Tableau will ask the same question number 5 in previous section. Click “NO”.
4. All done.
As discussed in Introduction section, Tableau cannot pass Google credentials unattended; at least it cannot do that now. So, the published data source needs to be refreshed manually. To refresh the Google Analytics data source:
1. Open Tableau desktop and select “Tableau Server” from the left pane
2. Enter your Tableau credentials to connect to Tableau server
3. Select the site
4. Click on “Google Analytics” data source
5. Right click on the Google Analytics data source-> Tableau Data Server-> Refresh from Source
6. Enter the credentials and click “Sign in”
7. Accept the permissions that Tableau Desktop needs to connect to your Google account
8. The data source is successfully refreshed.
How to automatically refresh a published Google Analytics data source based on Tableau Server Schedules?
So far we didn’t resolve the problem! The problem was that when we wanted to publish the Google Analytics data source into Tableau server, if Tableau server couldn’t pass the credentials to Google, an error message pops up. If we do not select “Embedded password” in “Authentication” part when we are publishing the Google Analytics into Tableau server, the data source won’t be refreshed automatically based on a predefined schedule in Tableau server. But, why Tableau server cannot pass the Google credentials? We need to check our firewall settings to see if it blocks ports 80 and 443. Google Analytics uses ports 80 and/or 443. After correcting the firewall settings Tableau server should be able to pass Google Analytics credentials. So, we need to republish the Google Analytics into Tableau. The steps for publishing are the same as we did before in number 5 of “Publishing Google Analytics data source into Tableau” section. The only difference is that we need to select “Embedded password” in Authentication section. We can select a predefined schedule in “Refresh Extract – Full” section and the click “Publish”.
Now the Google Analytics data source is successfully published and it will refresh automatically from Tableau Server based on selected schedule.
We can check the schedule task from Tableau Server to see if the published data source is refreshing as expected. All done.