cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Knowledge Base

Definitive answers from Designer experts.
Announcement | Looking to expand your Alteryx skillset?! Check out the latest set of interactive lessons in Alteryx Academy: Creating Analytic Apps
 You are using an unsupported browser for translation. Please switch to another browser.

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:     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   Please visit the Google Analytics webpage and sign in https://www.google.com/analytics/     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.       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).    Once on this page you can click on the 'Analytics API' link      When on the landing page for the Analytics API please press the ‘Enable’ button. Once this is enabled the button should change to ‘Disable’.    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.    On the next page make sure the Application type selection is Web application   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.   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 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) 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.         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: 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!   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) 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.   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) Make sure you have installed a Google Tracking Code on the target website. If not this is something the web developer would have to do. For more information please look here: https://support.google.com/analytics/answer/1008080?hl=en     ‘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)   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)     Please check the ‘Reset to default’ option and run the Google Analytics Connector. This will re-write the four XML file into Program Files.     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
View full article
The following steps detail how to obtain a client ID, client secret, and refresh token that can be used for authentication with Google related tools.   1. Open the Google Developers' Console 2. Login with the Google account associated with the data you would like to analyze 3. Create a new project by clicking the My Project dropdown (top-left corner) and selecting   Create project (top-right corner of the pop up 4. Enter a Project name of your choosing and click Create     5. If you have not already enabled the Google API you will be working with, you can do so by navigating back to the webpage we started on, the Console Dashboard, and clicking Enable API:     For Google Analytics: Other popular APIs >> Analytics API For Google Drive: G Suite APIs >>   Drive API Click Enable: 6. After you've confirmed that your API is enabled you can obtain API credentials by returning to the Console and clicking on Credentials in the left-hand navigation pane next to the key icon 7. Click on the Create Credentials dropdown and select   OAuth client ID:     8. Select the Web application radio button and add   https://developers.google.com/oauthplayground   as an Authorized redirect URI before clicking   Create 9.  At this stage, a pop up should appear where you can copy and save your Client ID and Client Secret You can also find your Client ID and Client Secret by returning to the Developer's Console >> Credentials and clicking the name of the app we just created:         10. Go to https://developers.google.com/oauthplayground 11. Click on the gear icon in the top-right corner of the page and click the checkbox for   Use your own OAuth credentials, enter the client ID and client secret from step 13, and click   close 12. Copy/paste the respective scopes into the Input your own scopes field and click Authorize APIs For Google Analytics https://www.googleapis.com/auth/analytics.readonly For Google Sheets  https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.appdata,  https://www.googleapis.com/auth/drive.readonly, etc 14. Click Allow 15. Click Exchange authorization code for tokens and save the Refresh token 16. Test the authorization by sending a request for an available operation from List possible operations 17. If successful, the client ID, client secret, and refresh token that you obtained in the prior steps can now be used for authentication with the Google related tools
View full article