community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.
#SANTALYTICS

The highly anticipated Alteryx Community tradition is back! We hope you'll join us!

Learn More

The 'How to Guide' to Google Analytics

Alteryx
Alteryx
Created on

Alteryx has recently released (Mar 2018) a new Google Analytics Connector. You can download it here

 

Here is an overview of the new GA tool in Alteryx Designer 11.0:

 

(view in My Videos)

 

Connecting to Google Analytics is becoming more and more popular and

There are a few things you need in order to use the Google Analytics macro:

  • A Google Account (e.g., Gmail)
  • Authorized Access to an existing Google Analytics account

 

Step 1: Set up a Google Analytics account

 

 

1.png

 

  • On the landing page for Google Analytics you will need to add the Account Name, Website Name and website URL.
  • Once you have entered this information you can click ‘Get Tracking ID’ and this will generate a Tracking Code for the website you would like to attain information on.
  • Once you have generated this code this will take you to Google Analytics Home Page.
  • Creating the Tracking ID creates a Profile ID and/or View ID with the associated website URLs which are used in the back end in the Google Analytics Macro within Alteryx.
  • If you would like to find this information please click on the Admin tab on the Google Analytics home page and navigate to the ‘Property Settings' and 'View settings' to see the Tracking ID and Profile ID/View ID respectively.

2.png

 

 

 

Step 2: Now it is time to set up the Client ID, Client Secret, and Refresh Token needed for the Google Analytics Macro:

 

  • Go to the Google developers page: https://developers.google.com/ 
  • You will now need to navigate to the 'Google API Console' (This can be found at the bottom of the developers.google.com page). 

GA 1.png

 

  • Once on this page you can click on the 'Analytics API' link

 

GA 2.png

  

  • When on the landing page for the Analytics API please press the ‘Enable’ button. Once this is enabled the button should change to ‘Disable’.

6.png

 

  •  Congratulations!  You have registered your application by creating a project.

 

 

Step 3: Generate your Client ID and Client Secret

  • Within the API Manager you should see a 'Create credentials' option. Click ‘OAuth Client ID’ when the drop down menu appears. 

7.png

 

  • On the next page make sure the Application type selection is Web application

8.png

 

  • This will generate additional required information below. You can leave the Name as Web Client 1, but please change the Authorized redirect URIs (second option under restrictions) to: https://developers.google.com/oauthplayground
  • Hit Create and wait a few seconds for Google to create your new project.

9.png

 

Acquire your Refresh Token

  • In another tab in your Web Browser please navigate to Google’s OAuth Playground https://developers.google.com/oauthplayground
  • Once on the landing page firs click the cog icon button near the upper-right corner of your monitor
  • Check the box Use your own OAuth credentials and make sure Access type is set to Offline
  • Paste in your Client ID in the ‘OAuth Client ID’ field
  • Paste in your Client Secret in the ‘OAuth Client Secret’ field
  • Hit Close

GA1.png

  • In the sidebar on the left, scroll down to the Google Analytics API v3 under Step 1 Select & authorize APIs
  • Click the little grey triangle on the left and select https://www.googleapis.com/auth/analytics.readonly
  • Hit Authorize APIs (you will be directed to another page)

GA2.png

  • When prompted, hit Allow. You will be redirected back to the OAuth 2.0 Playground.
  • Once you’ve been redirected back to the OAuth 2.0 Playground hit the Exchange authorization code for tokens button.

 

 

Ga55.png

 

 

  • Your Refresh Token will be contained in a JSON object towards the bottom of the Request / Response section. You can copy this string and save in the same location as your CLient ID and Client Secret.

 

  • Congratulations!! You now have all the pieces you need to use the Alteryx Google Analytics Connector!!

 

Step 4: Lets move to Alteryx!

  • The Google Analytics macro can be downloaded here and found in the Connectors tab
  • Once you have the macro on the canvas you will have two login options:

GA11.png

  • Online Login: This will take you to your Google Login and will automatically create a Client ID, Secret & Refresh Token
  • Offline Login: This will allow you to enter in your Client ID, Secret and Token. This process is recommended for those scheduling the GA tool. 

 

  • Once logged in you will be prompted to select an available Account; WebProperties; Profiles. Each configuration window will prompt you to press Next to move to the next screen.
  • The GA tool will allow you to select the Date, Metrics & Goals, Dimensions & Segments and give you a summary view to show you selections
  • Once you see this summary press run and you will now see your data.

 

Tips and Tricks

  • Check out the S datastream output – it contains summary information with each run, and in this case shows all of the account/property/view combinations that are associated with the credentials and loaded in. The D stream will show the data from Google Analytics.
  • When querying custom metrics, dimensions, or segments, you can only be allowed to select a certain combination. The GA tool will notify you of this.
  • Every query requires you to select a profile, at least one metric, and a date range. Everything else is optional.

 

Click on Spoiler to see all error messages and troubleshooting tips!

 

Spoiler

Common Issues (Prior to Version 3)

 

The Refresh token lasts about 1 hour so please remember to refresh the token as this will prompt errors.

 

  • Please repeat Step 4 above to refresh the token. Remember to add your Client ID and Secret into the oauth credentials before Authorizing the API!

 

‘The Field ‘id’ is not contained in the record…’ (Upgrade to the latest GA tool)

18.png

This error message can allude to a number of issues. However, to limit trial and error I have prioritized the solutions below based on prior troubleshooting experience (I know im awesome). 

 

1)

  • Please request 'Full control' or as minimum 'read & write' permissions to the supporting macros folder.
  • For Admin installs this folder can be found in: C:\Program Files\Alteryx\bin\RuntimeData\Macros\Supporting_Macros (Relative to where you installed Alteryx). 
  • For Non-Admin installs this folder can be found in: C:\Users\{USERNAME]\AppData\Local\Alteryx\bin\RuntimeData\Macros\Supporting_Macros (relative to your user name) (App data is a hidden folder so you may need to turn hidden folder on) 
  • The reason is outlined in more detail below, but in short, the GA connector reads & writes files necessary for the API connection in these locations. If we do not have write permissions the API connection will fail and give us the error above. 
  • ****DISCLAIMER - YOU WILL NEED TO GET YOUR IT PERMISSION TO DO THIS. Unless you have admin rights to your machine. 

2)

  • Your refresh token has expired
  • Please follow Step 4 above and remember to add your Client Secret and ID into the Oauth credentials section on the right hand side before Authorizing the API. 

3) 

  • Are you inside your company firewall?
  • If you have tried the above solutions and neither of them worked please try outside of your company firewall (With your IT departments blessings of course) 
  • I have not seen many instances of this but this did resolve the issue in a few cases. 

 

 

 

‘Tool #349: Tool #4 Error Transferring data: Failure when receiving data from the peer’ (Upgrade to the latest GA tool)

 

  • Check Profile ID
  • This can also be firewall issues, check with IT if they are blocking transaction from Google Analytics to the user.

 

 

‘Tool #574: Tool #522: Error creating the file "C:\Program Files|Alteryx\bin\RuntimeData\Macros\Supporting_Macros|GoogleAnalytics.DIMENSIONS.xml": Access is denied.’ (Upgrade to the latest GA tool)

‘Tool #574: Tool #706: Error creating the file "C:\Program Files|Alteryx\bin\RuntimeData\Macros\Supporting_Macros|GoogleAnalytics.PROFILES.xml": Access is denied.’ (Upgrade to the latest GA tool)

 

  • The Google Analytics macro is dependent upon deleting and updating four files within Program Files. These four XML files are the Profiles, Dimensions, Segments and Metrics. Currently a command line window flashes for a second at the start of running in Update mode – this is to circumvent an access limitation (because the installation files are located in Program Files, they cannot be overwritten – but they can be deleted and written anew). This allows the metrics, dimensions, and segments XML files to be updated.

19.png

 

  • Sometimes due to internal setting these files cannot be accessed and you may get an error saying ‘Access Denied’ (error referenced above). If this is true you can contact your IT to give you permissions to this file location. Alternatively you can run Alteryx as Administrator and this may give you the elevated Admin privileges to right to this Location from Alteryx (Right click on the Alteryx Icon and ‘Run as Administrator’.

 

 

‘You have set up the Google Analytics Connector Tool and want to know the # of records is produced in the data output? ‘ (Upgrade to the latest GA tool)

 

  • The macro aggregates the data across the entire time period, and is grouped by dimension. If you don’t choose any segments in the query, then there will be one row. If segments are selected, then you’ll get multiple rows back for each possible value of dimensions. If you want to retrieve one record per day, the best way really is to setup a little batch or iterative macro to loop through a collection of dates.

 

 

‘You have got a Client ID, Client Secret and a Refresh Token however you do not return any results. ‘ (Upgrade to the latest GA tool)

 

 

‘Receiving a createRecord: A record was created with no field’s error.’ (Upgrade to the latest GA tool)

  • Try right clicking on the Alteryx Designer Icon and ‘Run as Administrator’. This can give elevated permissions to access the dimensions, Profiles and Metrics in Program Files.

 

 

‘Unknown Variable’ (Upgrade to the latest GA tool)

20.png

 

  • This error will appear when youe enter in the Client ID, Secret and Refresh Token. Do not fear, just configure the search tab and this error will be removed once you run the GA connector. 
  • Please refer back through the steps above as you have more than likely missed a step in the configuration. This error has appeared when the ‘Analytics API’ has not been enabled.

 

 

Could not find file…’ (Upgrade to the latest GA tool)

 

22.png

 

  • Please check the ‘Reset to default’ option and run the Google Analytics Connector. This will re-write the four XML file into Program Files.

22.png

 

 

CONGRATS you have now made it through the worlds longest but most informative Google Analytics Article (in my opinion).

 

Now go free and play with your Google Analytics Data in Alteryx

 

 

However, if you continue to have problems with the Google Analytics connector please reach out to Alteryx Support

 

 

Best,

 

Jordan Barker

Client Service Representative

Comments
ACE Emeritus
ACE Emeritus
Hi

Quick response off phone but will post in more detail.

Yes in short. It’s all about dimension selection.

Select date and that will give you daily. For purchases you need the transaction id.


Sent from my iPhone


Gavin Attard
Digital Analytics Manager
GavinAttard@essentra.com
T: +44 (0) 1865 819 430

F: +44 (0) 1865 370135
www.essentra.com

Essentra
Langford Locks
Kidlington, Oxford OX5 1HX
United Kingdom


Essentra plc | RegisteredNumber: 5444653 | Registered in England and Wales | Registered Office:Avebury House, 201-249 Avebury Boulevard, Milton Keynes, Buckinghamshire, MK91AU
This e-mail may contain proprietary information and/or copyright material. This e-mail is intended for the use of the addressee only. Any unauthorised use may be unlawful.
If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this email in error, please delete it and notify us immediately by return email.
Be aware that Essentra may monitor incoming and outgoing e-mails to ensure compliance with the Essentra IT Usage policy.

Hi @GavinAttard!

 

I set the dimensions to extract transactions over a period of time alongside with its ID but I ran into an issue as it seems like I'm capped at 10K results. 

Is there a way to identify and build off from GA's endpoint pairing it with the Downloads tool?

GABlending1.PNGSelecting Date and Transaction ID led to an error...

 

 

 

ACE Emeritus
ACE Emeritus

Hi 

 

I don't believe so, but i stand to be corrected as i haven't ever hit the limit. However a quick look over the google developer documentation, i couldn't' find anything there.

 

Beet approach is to shorten the date range on the request then blend the data for each load. 

 

 

Hi @JordanB,

 

I'm on alteryx 10.6 with the latest GA connector v.7. I'm trying to connect via the "online" credential process. I've selected my account, property and view. However I can't click on the Next button:

 

Capture.PNG

Alteryx
Alteryx

Hi @am_analyst

 

Can you reach to support@alteryx.com to get a response on this.

 

Best,

 

Jordan

Alteryx Partner

I am running into the exact same issue as LoganLugoAnalytics. Getting that same error message after hitting 10,000 records, no go...

Using version 7.0.4 of the connector...



Meteor

Hi,

Can anyone tell me how to pull out the longterm GA cookie in the GA API? 

 

If you need more background, please read on...

 

We run online surveys using the Clicktools platform. A colleague exports some survey data from Clicktools to GA where we can look at survey data (demographics, goal achievement etc) alongside behaviour (page views, search exits). I want to pull the combined (survey/GA) data back out to Alteryx and then Tableau (where I will have more flexibility to analyse and report). But to combine with the more comprehensive survey data in Tableau, I need the clientid that is passed from Clicktools to GA

 

This is what I've been told "The survey invitation code reads the ClientID and passes it as a hidden question response when the user accepts the invitation. We then pipeline that answer into the Google Analytics tag using JavaScript in Clicktools. The ClientID is in the long term GA cookie dropped by the client site. It refers to a specific user/device but doesn't directly link to what is currently considered personal information. You can use it in the GA interface to look at individual visits/visitors. Hopefully Tableau will be happy to spot the same unique values in the two data sources and connect them together."
 
I can't see anything that looks like the GA cookie in the API interface. Nor can I find the GA cookie in the GA interface to give me a clue as to what I'm looking for. 

Regards,
Helen
 
 
ACE Emeritus
ACE Emeritus

Hi Helen

While google will capture the ClientID, it does not make this available to Google Analytics users as of yet.

The way round is you need to get whoever is responsible for your tag management to pick up the clientID from the cookie and send it as a custom dimension in the google tag.

You will then be able to download the custom dimension as a field in Alteryx and use for stitching as you described.

I also suggest if you are going down that route to add the following dimensions that will be immensely useful:


? User ID (if you have one - remember non personally identifiable)

? Timestamp

? Session ID


custom dimensions.JPG



Gavin Attard

ACE Emeritus
ACE Emeritus

@fpinchon - 

 

Yes, google's API has a 10K record return limit. The way round this is to break down your requests into shorter date ranges then union in Alteryx. or if that is still too big limit by hour etc.. using ga filters. 

 

 

Awesome!

*Logan Lugo*

Moderator
Moderator

@HelenL @LoganLugoAnalytics @GavinAttard - there is a 10k limit per query, but the tool has a built in functionality to iterate through queries up to 9999 times. This was broken in the last release, hence the error - it will be fixed in version 7.0.5 of the GA tool, which should be released shortly! (I believe it may actually be up on the Gallery already)

Alteryx Partner

@SophiaF

Now, that IS exciting news!

Looking forward to try it!

When I drop the GA tool into Alteryx, I only get the following screen in configuration - there is no signon button, no prompt. When I enter the credentials, nothing changes, and when I run the workflow with the credentials entered I get the following error:

 

 screenshot_269.png

Alteryx Certified Partner

While using version 13 of the tool on 2018.1.3 I've run into a problem when a Google Analytics profile uses custom dimensions and metrics and has at least one of those disabled/in-active. It would show a spinning circle after the date selection screen. Enabling/activating the custom dimension or metric would resolve the issue and allow for normal usage of the tool.

Schermafbeelding 2018-05-28 om 13.20.53.png

 

Meteor

Hi,

I've used Jordan's excellent guide successfully in the past. 

 

I haven't used the GA connector for about six months. I've recently updated Alteryx to 2018.4. So before I started, I followed Jordan's link to the gallery to download the latest version. https://gallery.alteryx.com/#!app/Google-Analytics/5898afe9effc2a0bb0a11644/run. However, it is marked version 7. So first question: What is the latest version and where can I download it? mverstrepen is using version 13.  

 

I have access to the Google Analytics for five clients.  I'm able to connect to two of them (I reach the Select Metrics and Goals to Include). However for the other three GA properties, I get the spinning circle after the date selection screen. I can access these properties OK through the Google Analytics interface so I do have the necessary permissions. 

 

I'm running Alteryx Admin Designer 2018.4.5.55178. I've working Offline. So second question: Do I need to follow mverstrepen's advice and enable/activate the customer dimension or metric? If so, can you guide me to do this? I don't see a spanner, I see a cog. Thank you! 

 

Regards,

Helen

Alteryx
Alteryx

HI @HelenL 

 

I have to thanks @mverstrepen for bring this to our attention! Unfortunately, he may be able to provide better direction that myself on the config directly in Google Analytics

 

Regarding version 13, I am not sure where this is from as the latest is version 7.07 from the Alteryx Gallery

 

Best,

 

Jordan

Alteryx Certified Partner

Hi @JordanB and @HelenL.

It's been a while, but I was referring to the upload version of the GA tool (currently version 16).
Schermafbeelding 2019-02-04 om 10.30.38.png
I am not sure if this issue has been resolved since the version I've used. You could test this by verifying the following setting in GA (see screenshot).

Schermafbeelding 2019-02-04 om 10.27.45.png

Kind regards, Martijn 

Alteryx Partner

Hi,

 

did you found the reason why you can't select available Accounts when using the offline mode, but you do when you're in the online mode?

 

Thanks 

Dear Alteryx desginers,

 

I am using this API, and in 2019 I am trying to pull data for 2017. Any knowledge why this is not working. It is pulling fine 2018 onwards.

 

Best,Sudeep

Alteryx Partner
@sudeepl05 Are you trying to extract beyond the 18 months history limit? I don't think you can query GA data beyond 18 months...
Atom

Is it possible to set the refresh token to automatically refresh after the time limit is up (or stay signed in). I am looking to run this on a daily schedule and don't want to have to sign in every time. (I am sort of assuming the answer is no, but hoping someone has a workaround for me on this!)

 

Annie

Meteoroid

Just wanted to call out that there is more than 1 Google Analytics API that comes up as an option for Step 2. The correct one is called "Google Analytics API". Don't use the one that says "Reporting" because it won't work.

 

Alteryx Google Analytics API.png

Has anyone got an answer to Annie's query above? i've got the same question. i'd like to setup a GA workflow to run on schedule every day.

ACE Emeritus
ACE Emeritus

@ahaley  @am_analyst Yes use Offline method to sign in. 

Atom

@GavinAttard @am_analyst that's what I did as well. Took me a little bit to figure out how but it's been running well.

Asteroid

Hi @JordanB ,

 

Thanks for sharing !!

 

If we are under company firewall, which URLs should be white-list ?

 

Best Regards,

Samuel