Google Analytics Migration¶
Google Analytics is an analytics service that measures traffic and engagement across your websites and apps. It is a new kind of property with different reports than what you are used to seeing in Universal Analytics properties:
Collects both website and app data to better understand the customer journey.
Uses event-based data instead of session-based.
Includes privacy controls such as cookie-less measurement, and behavioral and conversion modeling.
Predictive capabilities offer guidance without complex models.
Direct integrations to media platforms help drive actions on your website or app.
You can configure Denodo to retrieve data from Google Analytics by creating JSON data sources and base views in Denodo using the Google Analytics Data API.
As Google Analytics manages a very large amount of data and views, it may be hard work to add all the required data sources and base views in Denodo. In order to make this process easier and faster, we offer Google Analytics wizard. You just have to configure a few parameters in the form and Execute import into your Denodo server to get access to Google Analytics.
These Wizards for Google Analytics are adapted to Google Analytics 4.
Getting OAuth 2.0 Credentials¶
First, you need to register an application in the Google Cloud Console. This is to obtain the credentials that you will enter later, to connect to the API of this service.
Create a project in the Google Cloud Console.
Enabling Google Analytics Data API v1.
Filling the OAuth consent.
Create OAuth 2.0 credentials.
Note
Fill in with the values corresponding to your environment or see the Google Analytics documentation for more information.
Now, go back to the Design Studio and click the menu Tools > OAuth credential wizards > OAuth 2.0 wizard. Use this wizard to obtain the OAuth access token, and refresh token.
To get the OAuth tokens, enter the following parameters:
Client identifier. The client ID generated in the Google Cloud Console.
Client secret. The client secret generated in the Google Cloud Console.
Token endpoint URL. https://oauth2.googleapis.com/token.
Authorization server URL. https://accounts.google.com/o/oauth2/auth.
Redirect URI. http://localhost:9090/oauth/2.0/redirectURL.jsp.
Scopes. Enter this:
https://www.googleapis.com/auth/analytics.edit
https://www.googleapis.com/auth/analytics
https://www.googleapis.com/auth/analytics.readonly
These scopes are necessary to have the necessary privileges to query your data.
Note
If the callback URL is not externally accessible, the browser will display an error page when you try to get the authorization response URL. Just discard the error and copy the URL at your browser address bar in step 3.
Importing Artifacts¶
Now, you have all the data needed to create the predefined Google Analytics reports.
Click the menu File > New > Data source and select Google Analytics 4.
Provide these values:
Database. Database in which the predefined Google Analytics reports will be created.
View name prefix. You can configure the name prefix of every view and folder created in the VDP in order to be able to relate VDP views to Google Analytics properties. The max length of this parameter is 10 characters.
Property id. A Google Analytics GA4 property identifier whose events are tracked. You can use the Google Analytics wizard as many times as properties you have defined in your Google Analytics tool to get data of all of them.
Client ID. The client ID generated in the Google Cloud Console.
Client Secret. The client secret generated in the Google Cloud Console.
Access token. The access token generated in the wizard of the previous section.
Refresh token. The refresh token generated in the wizard of the previous section.
Redirect URI. The OAuth 2.0 redirect URI configured.
Now, click Execute import to create the data sources and the views for querying your predefined Google Analytics reports.
Note
In the examples below, we used view1 as the value of the parameter View name prefix.
GA4 Migration Predefined Reports¶
These views are a migration from Google Universal Analytics to Google Analytics 4. All of them have two required parameters:
startdate
and enddate
:
${view_name_prefix}_ga4_browser. This report uses the following parameters:
dimension
. browser.metrics
: averageRevenuePerUser. bounceRate, engagementRate, conversions, sessionConversionRate, totalUsers, averageSessionDuration, userEngagementDuration, totalRevenue.
${view_name_prefix}_ga4_device_category. This report uses the following parameters:
dimension
. device_category.metrics
. sessions, bounceRate, totalUsers, averageSessionDuration, screenPageViewsPerSession, eventCount, userEngagementDuration, averageRevenuePerUser, totalRevenue .
${view_name_prefix}_ga4_event_name. This report uses the following parameters:
dimension
. event_name.metrics
. eventCount, sessions, eventsPerSession, averageSessionDuration, screenPageViewsPerSession, bounceRate, totalUsers.
${view_name_prefix}_ga4_first_user_campaign. This report uses the following parameters:
dimension
. firstUserCampaign.metrics
. sessions, bounceRate, totalUsers, averageSessionDuration, screenPageViewsPerSession, eventCount, userEngagementDuration, averageRevenuePerUser, totalRevenue.
${view_name_prefix}_ga4_first_user_medium. This report uses the following parameters:
dimension
. firstUserMedium.metrics
. sessions, bounceRate, totalUsers, averageSessionDuration, screenPageViewsPerSession, eventCount, userEngagementDuration, averageRevenuePerUser, totalRevenue.
${view_name_prefix}_ga4_first_user_source. This report uses the following parameters:
dimension
. firstUserSource.metrics
averageRevenuePerUser, bounceRate, engagementRate, screenPageViews, sessionConversionRate, totalUsers, averageSessionDuration, userEngagementDuration, totalRevenue.
${view_name_prefix}_ga4_first_user_source_medium. This report uses the following parameters:
dimension
. firstUserSourceMedium.metrics
. averageRevenuePerUser, bounceRate, engagementRate, screenPageViews, sessionConversionRate, totalUsers, averageSessionDuration, userEngagementDuration, totalRevenue.
${view_name_prefix}_ga4_landing_page. This report uses the following parameters:
dimension
. landingPage.metrics
. averageSessionDuration, screenPageViewsPerSession, sessions, userEngagementDuration, averageRevenuePerUser, totalUsers, totalRevenue, eventCount, bounceRate.
${view_name_prefix}_ga4_page_path. This report uses the following parameters:
dimension
. pagePath.metrics
. averageRevenuePerUser, bounceRate, engagementRate, screenPageViews, sessionConversionRate, totalUsers, averageSessionDuration, userEngagementDuration, totalRevenue.
${view_name_prefix}_ga4_session_campaign_id. this report uses the following parameters:
dimension
. sessionCampaignId.metrics
. averageRevenuePerUser, bounceRate, engagementRate, eventCount, engagedSessions, totalUsers, averageSessionDuration, userEngagementDuration, totalRevenue.
Query¶
Now, you can execute the predefined Google Analytics reports. In the example below the ${view_name_prefix}_ga4_event_name view has been executed.