Skip to main content

Google Analytics 4 Connections

Google Analytics 4 Connections

Note

Feature Availability: This feature might not be available in all product editions. 

Google® Analytics 4® is a web analytics service offered by Google that tracks and reports website traffic. Version 4 represents the latest schema for Google Analytics data. For more information, go to https://analytics.google.com/analytics/web/provision/#/provision. 

Note

This connection type reads from the GoogleAnalytics4 schema only.

For more information on the differences between Google Analytics and Google Analytics 4, go to https://support.google.com/analytics/answer/10089681?hl=en.

Note

  • Per Google’s announcement here and here, Universal Analytics will not process new data. The Google Analytics driver might allow access to Universal Analytics, but if Google decides to deprecate or remove API support for Universal Analytics, it is highly likely that your Google Analytics connector to Universal Analytics property will fail to import data.

  • A Google Analytics connection comes with the ability to access any one of the two data sources, Universal Analytics or Google Analytics 4. It's recommended that you create a new connector for each of the two data sources.

  • While creating a connection, you can use Google Analytics 4 or Universal Analytics by choosing Google Analytics 4 and Universal Analytics under the Schema dropdown. 

Limitations and Requirements

Note

During normal selection or import of an entire table, you might encounter an error indicating a problem with a specific column. Since some tables require filtering based on a particular column, you can only ingest data from them using custom SQL statements. In this case, use the problematic column as a filter in the WHERE clause of a custom SQL statement to ingest the table.

  • For more information, consult the CData driver documentation for the specific table.

  • For more information on using custom SQL, go to Create Dataset with SQL.

Note

For filtering date columns, this connection type supports a set of literal functions on dates. Use these to reduce the volume of data extracted from the database using a custom SQL query. For more information, go to the pg_dateliteralfunctions.htm page in the driver documentation for this connection type.

Note

Most interactions with the Google Analytics datastore are formed as custom SQL queries. The next sections have more information on syntax and examples.

  • OAuth 2.0 authentication is required. 

  • Only the Google Analytics 4 schema is supported.

  • Google Analytics 4 allows up to 10 metrics and 7 dimensions in a single query.

    • When issuing a query that selects all columns, only the default Metric columns are selected for tables with more than 10 Metrics.

    • The default Dimensions are used unless you explicitly select other dimension columns.

  • All reports in Google Analytics 4 must cover a specific date range.

    • If the StartDate and EndDate inputs are left unset, the default behavior is to pull the last month of data.

    • To override this behavior, set the values directly in the query.

For more information, go to the driver documentation http://cdn.cdata.com/help/DAG/jdbc/.

Example queries: To import data from Google Analytics, you typically create a custom SQL SELECT statement. Example:

SELECT distinct Date, Sessions, NewUsers, BounceRate, PageviewsPerSession, AvgSessionDuration, Browser, FROM GoogleAnalytics.Traffic where StartDate = '90DaysAgo' and EndDate ='Today' 

Note

The distinct keyword is currently required in default configuration when referencing specific values in a WHERE clause. Optionally, you can enable the use of enhanced SQL for this connection, which eliminates the need for the distinct keyword.

  • Do not apply quotes, double quotes, or brackets around field or table values.

  • Literal values should be in single quotes.

  • Use StartDate and EndDate parameters to specify a date range. You can also use date literal functions to specify date ranges.

For more information, go to http://cdn.cdata.com/help/DAG/jdbc/pg_dateliteralfunctions.htm.

For more information:

Create Connection

Create a connection via the  Designer Cloud application,

When you create the connection, review these properties and specify them accordingly:

Connection Property

Description

View Id / Property Id

Unique identifier of the view.

Tip

To acquire your View Id, sign in to Google Analytics 4 and navigate to your site data. Select the name of your site in the top menu bar. The identifiers for the available views are listed as numeric values in the right column.

Connect String Options

This is the default connect string option:

Timeout=0;SupportEnhancedSQL=true; 

  • The first option sets the connection timeout in seconds.

  • Setting this value to 0 disables timeouts. For more information on the second option, gp to the Data Type Conversions section on this page.

OAuth2 Client

The client is displayed.

Note

When you create the connection in this window, you must select Authenticate, which authenticates to the app. This step is required.

Default Column Data Type Inference

Leave this value as Enabled.

For more information, go to the driver documentation https://cdn.cdata.com/help/DAG/jdbc/pg_GoogleAnalytics4model.htm.