Create API Credentials

Great! Let’s move on to step 2, which involves creating API credentials for your Google Cloud project to access the Google Analytics data programmatically. Here are the detailed instructions:

Step 2: Create API Credentials

  1. Access the Google Cloud Console: Go to the Google Cloud Console ( and sign in using your Google account.
  2. Select your project: From the project dropdown menu at the top of the page, choose the project you created in step 1.
  3. Navigate to API Credentials: On the left sidebar, click on “APIs & Services” -> “Credentials”.
  4. Click on “Create Credentials”: In the Credentials section, click on the “Create Credentials” button and select “OAuth client ID”.
  5. Choose application type:
  • Select “Web application” as the application type.
  1. Configure the OAuth client ID:
  • Enter a name for your credentials (e.g., “Google Analytics API Access”).
  • Add the authorized JavaScript origins and redirect URIs as needed. For local development, you can use http://localhost as the origin and http://localhost/redirect as the redirect URI.
  • Click the “Create” button to generate the OAuth 2.0 Client ID.
  1. Retrieve the Client ID and Client Secret:
  • After creating the OAuth client ID, you will see a popup or a page displaying the Client ID and Client Secret values.
  • Take note of the Client ID and Client Secret as you will need them in the next steps for authentication.

With the API credentials created, you have the necessary authorization to access the Google Analytics data through the Google Analytics Reporting API. In the next steps, we will set up the development environment and authenticate using these credentials to retrieve the historical data.