Google Analytics FAQs

Data Sources

Google Analytics Tips and Tricks

  1. Google Analytics data source connection
  2. Displaying Seconds as Time
  3. Using Google Analytics goal metrics
  4. Google Analytics sampling
  5. Querying Google Analytics custom segments
  6. Metrics and Dimensions to query in Google Analytics
  7. Google Analytics Custom Variables and Dimensions
  8. Google Analytics query limit
  9. Using custom segments in Google Analytics
  10. Google Analytics data source connection

Google Analytics data source connection

When adding a new Google Analytics data source to Chartio, you are prompted a Google login screen. After selecting the Google account and confirming the authorizations, if you return to Chartio but do not see the new data source listed, the issue may be that Google is not working with your ad block.

Please turn off ad blocker on your browser and reconnect the Google Analytics source to Chartio.

Displaying Seconds as Time

In order to display seconds in a time format, for example, to be able to see the average time per page from Google Analytics, add a step in the Pipeline. Choose Custom formula and type in

strftime(‘%H:%M:%f’, “ga:avgTimeOnPage” ,’unixepoch’).

Note: Replace “ga:avgTimeOnPage” with the column that contains your seconds.

Using Google Analytics goal metrics

Chartio supports querying all of the dimensions and metrics available through Google Analytics Core Reporting API. You can view the API documentation.

If you would like to use a goal conversion metric, you can—you’ll just need to enable it in your schema editor. Chartio hides some less commonly used columns by default to make your tables easier to navigate.

To enable hidden columns:

  1. From the top navigation, choose Settings > Data Sources.
  2. Select your Google Analytics data source and switch to the Schema tab.
  3. In the Schema Editor, find your column and check the Visible checkbox.

goal conversions schema display

Google Analytics sampling

You may find inconstancies with Google Analytics data in Chartio. The main reason for this is the fact that Google Analytics samples their data (See Google documentation on data sampling for more information). Depending on what Google Analytics account you have, you may be limited to sampled data. Only the premium accounts support unsampled data.

Click here for Google Analytics account info.

However, the numbers should still be fairly close - sampling is meant to give you a close approximation.

It seems the sample data is fairly accurate when it comes to visits and page views but can vary in a wide rage for revenue, transactions, and goal conversions. In one of the tests from the articles below, they found revenue could be off by 11% to 80%.

There’s a number of articles you can search for on Google.

To get unsampled data would require a Google Analytics premium account and BigQuery.

We currently use Google’s Core Reporting API V4. You may be able to return more accurate results by using:

“samplingLevel”: “LARGE”

More information on Reporting API V4

Additionally, you may be able to pull unsampled data using other various techniques, such as this technique, Pull More than 10k rows Unsampled using Google Analytics Sheets Add-on.

Querying Google Analytics custom segments

You can use Google Analytics custom segments in SQL Mode.

First, go to the Google Analytics Query Explorer, and log in to your Google Analytics account. Select your Property and View, and find your segment in the segment dropdown list.

Open the Google Analytics Query Explorer

Once you find your segment from the dropdown, you’ll see the segment id below its description. It will look something like gaid::-2.

You’ll need to use SQL Mode to include a custom segment, but we recommend building your chart in Interactive Mode first if you are not familiar with the Google Analytics querying language.

Once you have all of your dimensions and measures set up in Interactive Mode, switch to SQL Mode. Follow the format in the example below to insert your custom segment filter; add all of the bolded lines, replacing the segment id with your own.

"dateRanges":
- "endDate": "{TODAY}"
  "startDate": "2010-12-18"
"segments":
- "segmentId": "gaid::-2"
"dimensions":
- "name": "ga:date"
- "name": "ga:segment"
"includeEmptyRows": !!bool "true"
"metrics":
- "expression": "ga:sessions"
"pageSize": !!int "1000"
"post-process": "date"

In summary:

  1. Find custom segment id via Google’s Query Explorer, if you don’t have it already.
  2. Build the query in Interactive Mode in Chartio.
  3. Switch to SQL Mode, add “segments” header with segment Id, following the syntax in the example above.
  4. Add “ga:segment” under dimensions following the syntax in the example above.

Metrics and Dimensions to query in Google Analytics

Not all Google Analytics metrics and dimensions can be queried together. Check if a dimension and a metric combination is valid from within Google’s documentation in the Dimensions and Metrics Explorer.

In this example, we want to see which metrics we can query with eventAction. Click the plus sign to expand the Event Tracking table, which is where the eventAction dimension is located.

Click Event Tracking in the Core Reporting API documentation

Once it’s expanded, hover over ga:eventAction to reveal a checkbox, and check it. We want to check which metrics we can use in the eCommerce table, so we have expanded the eCommerce table to compare.

Some of the metrics in the eCommerce table are greyed out; this means we can’t query them with eventAction. You can query any metric that is not greyed out with eventAction.

Open eventAction under the Event Tracking tab

Google Analytics Custom Variables and Dimensions

By default your Google Analytics data source schema in Chartio will only expose five custom variables and 20 custom dimensions. However, if you have an Analytics 360 (premium) account, you can access up to 50 custom variables and 200 custom dimensions.

They can all be accessed from Chartio via SQL mode, but if you would like to view all the columns in the schema please contact us at support@chartio.com to enable the additional custom variables and dimensions.

Google Analytics query limit

Google Analytics enforces a 10k row max on all queries. This is a Google Analytics limit, not a Chartio limit.

Limit applied by Google Analytics

If you want to query past the limit applied to Google Analytics queries, you can use multiple datasets. Using multiple datasets in Chartio with the union join type, you can extract up to 100,000 rows.

Click here for more information on the Google Analytics limit.

Using custom segments in Google Analytics

You can use Google Analytics custom segments in SQL Mode.

Open the Google Analytics Query Explorer and log in to your Google Analytics account. Select your segment from the dropdown list next to the segment input.

Once you select your segment from the dropdown, its ID will appear in the segment text input box. Copy the ID, including gaid:: at the beginning.

In your Google Analytics chart in Chartio, switch to SQL Mode at the top of the chart editor and add your GA segment after your metrics, with &segment= added in front of it.

Example:

Codeblock in SQL Mode


Related Data Sources Help Articles

See more