Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Google Analytics


google-analytics-logo

Google Analytics is a web analytics service that provides insights into website traffic and user behavior.

Google Analytics allows website owners to track and analyze various metrics related to their website’s performance, such as the number of visitors, pageviews, bounce rate, and average session duration. It also provides information on the demographics and interests of website visitors, as well as the sources of traffic, including organic search, paid search, social media, and referrals. This data can be used to optimize website content and marketing strategies, as well as to measure the effectiveness of advertising campaigns. Additionally, Google Analytics offers advanced features such as goal tracking, e-commerce tracking, and custom reporting, making it a powerful tool for businesses of all sizes.

Prerequisites

To obtain the OAuth identity provider authorization endpoint used to create and refresh tokens, you need to create a project in the Google API Console and enable the Google Analytics API. Then, you can create OAuth 2.0 credentials and configure the authorized redirect URIs. The authorization endpoint will be provided in the credentials.

The OAuth scopes you need to request access to depend on the specific data you want to access in Google Analytics. For example, if you want to read data from a specific view, you will need to request the “https://www.googleapis.com/auth/analytics.readonly” scope. You can find a list of available scopes in the Google Analytics API documentation.

To obtain the Access Token and OAuth Refresh Token, you need to authenticate the user and obtain their consent to access their Google Analytics data. This can be done using the Google Sign-In API or the OAuth 2.0 authorization flow. Once the user has granted access, you will receive an Access Token and a Refresh Token that you can use to make API requests.

To obtain the View ID, you need to log in to your Google Analytics account and navigate to the Admin section. From there, you can select the account, property, and view that you want to access and find the View ID in the View Settings.

Settings

View ID

The ID of the Google Analytics view to retrieve data from.

Reports

The specific reports to retrieve data from in the Google Analytics view.

Start date

The start date for the date range of data to retrieve.

End date

The end date for the date range of data to retrieve.


Table of contents