# Google Analytics

The Google Analytics integration can be used once a new project is created and configured in Google Console.

# Setup

  1. Create a new project here (opens new window)
  2. Click on APIs and Services (opens new window) in the side menu
  3. Click on Library (opens new window) in the side menu and type analytics in the search bar
  4. Click and enable both Google Analytics Reporting API, Google Analytics API, and Google Analytics Admin API
  5. Head back to the APIs and Services (opens new window) page and click on OAuth Consent Screen (opens new window) option in the side menu
  6. Select on either Internal or External depending on how you plan to use the integration
  7. You will have to fill in all the required details in the form (no need for domain yet) then continue without filling anything on the rest of the tabs
  8. Click on Credentials (opens new window) in the side menu, click on Create credentials, and select OAuth Client ID
  9. Select Web application from the dropdown list, enter any name, and in Authorized redirect URIs enter:
  • http://localhost:4018/google-auth (for local use)
  • https://example.com/google-auth (for production use with your domain)
  1. You will get a Client ID and Client Secret which you will have to use for the CB_GOOGLE_CLIENT_ID and CB_GOOGLE_CLIENT_SECRET environmental variables
  2. Head back to the OAuth Consent Screen (opens new window), scroll down the page, and add test users to enable certain google accounts to use the integration
  3. (Optional) If you want to publish the Google app, you will have to click on the "Publish app" at the top of the page (opens new window).

# Usage

To learn how to use the Google Analytics integration, you can read the tutorial on Chartbrew's blog (opens new window).