Google Analytics

The Qlik Google Analytics Connector loads web visitor data into your Qlik Sense or QlikView apps from your websites that have Google Analytics enabled.

Tip:

The Qlik Web Connectors help you connect to different data sources and fetch data in the same way. Learn how to authenticate a data source connection and how to use tables to fetch data.

Connecting to data sources

Ways to access your data

To use the Qlik Google Analytics Connector, you must have a Google account that has sufficient permissions to access Google Analytics data and to authenticate the connector.

You can click Test Connection to verify that the connection will work with the authentication token you entered. You must also name your connection before you can select data.

Tables

After authenticating the connector, the you can use the following tables to load data into your Qlik Sense or QlikView app.

Table Description
CanAuthenticate Enter your authentication information on this table.
CreateReport Returns a web profile report for a specific time period.
DataFromQueryURI

Enter a query URI on this table.

DataFromQueryURIQueryInfo Returns information about the query URI.
DataFromTemplateQuery Returns a report from a predefined list.
MCFData

Enter Multi-Channel Funnels queries on this table.

MCFDataQueryInfo Returns info about the MCF query.
RealTimeData Returns realtime data requests.
MetaDataColumns Returns list of metrics and dimensions information.
Accounts Returns the accounts that the user has access to.
WebProperties Returns the web properties the user has access to.
WebProfiles Returns the profiles that the user has access to.
CustomDimensions Returns custom dimensions that the user has access to.
CustomMetrics Returns custom metrics that the user has access to.
Segments Returns the segments that the user has access to.
Goals Returns the goals that the user has access to.
UnsampledReportsInsert Creates an unsampled report. Google Premium users only.
UnsampledReportsList Returns a list of unsampled reports. Google Premium users only.
UnsampledReportsGet Returns information about an unsampled report. Google Premium users only.
OtherData  
Note: UnsampledReportsInsert, UnsampledReportsList, and UnsampledReportsGet are only available for Google Premium users.

Using prebuilt data feeds

If you are using the connector, then the easiest way to get started is to use a prebuilt report using the DataFromTemplateQuery table.

Do the following:

  1. Authenticate the connector. See Connecting to data sources
  2. Select one of your available Profile IDs from the drop down list.

    Note: If you don’t see any Profile IDs check that your Google account has access to some by logging into the Google Analytics website or contacting your website administrator.
  3. When you have selected one of the Profile IDs, pick a Query, and enter a date range using the format DD-MM-YYYY.

  4. Click on Run Table/Generate Script.

You can then copy the script to your Qlik applications as you can with other connectors.

Building a data feed manually

This is the most powerful option and gives you full flexibility over the dimensions and metrics returned.

You can build a feed URL using the Data Feed Query Explorer from Google Analytics Demos & Tools.

The website must be authorized with the same account that you are using with the QlikWeb Connectors before building your feed, as it will allow you to select your site IDs and other items from the drop-down menus, such as the Web Property and Profile.

Do the following:

  1. Enter the required information in the Data Feed Query Explorer to build a feed.
  2. Click on Run Query.

    Note: Before proceeding, you should ensure that, when you click Run Query, the expected data is returned in this web interface.
  3. Once you have built and verified the data that has been returned, copy the generated API Query URl at the bottom of the page to your Qlik application.

  4. In the QlikGoogle Analytics Connector, select the DataFromQueryURl table, and paste the API Query URl into the Parameters.

  5. Click on Save Inputs and Run Table.

There are some important points to be noted:

  • you can only have up to 7 dimensions in your query.

  • the connector will automatically set the max-results to the maximum value of 10,000 to improve download times. This does not mean the results are limited to the first 10,000 rows but that each page of requests will pull down the maximum possible. The connector will loop through as many pages of data as it can, in the background, to get all the results.

  • it is important to understand how to use combinations of dimensions and measures.

Limitations:  

The Google Analytics API limits you to no more than 7 dimensions or 10 metrics. This is a limitation of the API.

Using custom variables

If you want to use custom variables while building the data feed, then you need to replace the (n) in ga:customVarValue(n) or ga:customVarName(n) with the relevant integer.

Example:  

The dimensions field = ga:date,ga:customVarValue1.

Loading goal data

The QlikGoogle Analytics Connector provides a Goals table which lists all the goals defined in your Google Analytics account.

You can build a manual data feed which pulls data on these goals and, in particular, the ga:goalxyz metrics. Note that many of these metrics require replacement of (n)) with the actual numerical ID of the goal. For example, goal(n)Starts may be goal2Starts in your feed URL.

Live/Realtime data

The RealtimeData table allows you to access the Google Analytics Realtime API.

Use the dimensions and metric reference guide to manually work the realtime dimensions and metrics into a feed URL, which is similar to the standard data table.

Unsampled reports

The connector includes UnsampledReportsInsert, UnsampledReportsList and UnsampledReportsGet tables, which are only accessible to a Google Analytics Premium user.

First use the UnsampledReportsInsert table to request a report to be generated. You will need to supply this table with a management.unsampledReportJSON object with end-date, metrics, start-date, and title properties. Optionally, you can specify dimensions, filters, and segment properties.

This returns an ID which you can use in conjunction with the UnsampledReportsGet table to monitor the status column and wait until it is COMPLETED. Alternatively, you can check the UnsampledReportsList table, when your application reloads, for any reports not yet loaded into the application.

Once the report has been loaded and sent to Google Drive (the only scenario supported at present), you can use the GetRawFileByIdAsText table in the QlikGoogle Drive Connector to load the report directly into QlikView or Qlik Sense, supplying the connector with the value from the driveDownloadDetails_documentId column from either the UnsampledReportsGet or UnsampledReportsList tables.

Possible error responses

If errors are returned when using this connector, please refer to the error response documentation.

API usage limits

For data tables in the QlikGoogle Analytics Connector, such as the DataFromQueryURI, DataFromTemplateQuery and RealtimeData tables, the Google Analytics API limits the connector to making 50,000 API calls per day per profile and this is reset at midnight, Pacific Time. Each API call can retrieve up to 10,000 rows of data.

Note that this limit can result in 403 Forbidden errors, or in messages in the QlikWeb Connectors responses or event logs, similar to the following:

{"domain":"global","reason":"dailyLimitExceeded","message":"Quota Error: profileId ga:XXXXXXX has exceeded the daily request limit."}

If you have other users accessing the same profile through the Google Analytics API from other non-Qlik web connector applications this will also contribute towards usage of this 50,000 API calls quota.

Reference - Google developer documentation

You can refer to the Google Analytics API reference documentation to learn more about how the Qlik Web Connectors interact with the Google APIs.

Troubleshooting

Trouble authenticating on the Google Explorer page

On trying to authenticate, a blank page and an error message are returned. This is a known issue and you should refer to the API group forum.

Note: This web page is a Google service and not in any way controlled or supported by Qlik. If you do experience a problem then we would recommend trying a different browser, for example Firefox or Chrome.

Unexpected data

If you are not getting the data you expect or are getting data conflicting with that in another table, either via QlikWeb Connectors or the Google Analytics interface, check your query in the Google Analytics Query Explorer.

Since the connector gets the data from the same system, there should be few or no differences at all.

Use the following to identify and reconcile the differences:

  • Run exactly the same metrics in the connectors as on the platform. Having an extra metric can change the result.

  • Use the connector (or the Google Analytics Query Explorer), and not your application, to check values by recreating the metric and looking at the data tab in QlikWeb Connectors.

  • Try to match the manual report to the connector, so if the connector gives you three columns of data, that is, date, pages visited and average time, then get the same report manually and compare the values.

  • Match the time scales. If the connector gives you each day's data for a month, but the manual report just gives you one figure for the whole month then values like averages will be affected.

  • Try a smaller time scale or data set as this will make it easier to identify where data is missing, so check numbers on a day by day basis.

  • Check the ranges coming back in the connector. If you select a date range, check that all those dates are in the data, that is, the first or last days are not missing.

  • If the values in the connector can be matched to the manual reports, but there is still a problem in the application, then you need to review your script, data model, expressions and objects, to check what you get in QlikWeb Connectors is the same as that fed into your application.

Differences can also be due to a misinterpretation of the dimensions and metrics or due to the sampling used by Google Analytics. A common solution to avoid sampling is to request data over smaller periods, for example, instead of requesting data for a month at a time, request data over a day or a week at a time. Note that you can use the connector’s QueryInfo table to ascertain whether the results would be sampled. You can then use this in your Qlik script to set a warning in the application or perhaps send an alert email using the SMTP Connector.

Authenticating problems

When authenticating the connectors, everything is grayed out and disabled, preventing you from completing the authentication.

The solution is to simply press F5 to refresh the embedded browser, causing it to become enabled, or to use the Authenticate (Manual) tab in the authentication dialog.

Alternatively, the authentication screen is completely blank (white). If you experience this first ensure that you can log in to the Google Analytics website using Internet Explorer. Users with this issue can experience the same problem in Internet Explorer due to security settings on their computer. You can resolve this by running QlikWeb Connectors as an administrator.

When you can log into the Google Analytics Website from Internet Explorer, it should then be possible to log in to the connector from QlikWeb Connectors.

Time-out error

If you are getting a time out error for your request then this may be due to the volume of the data you are requesting. For example, if you are requesting a month's data, try splitting this into a series of daily requests in your load script. and check if this solves your time out issue.

Did this information help you?

Can you tell us why it did not help you and how we can improve it?