Google Analytics

Create a new project in Google Cloud

If you are using GoogleAPIs for the first time, you will find the following display. Click "I agree .." in the Terms of Service and then click "Agree And Continue"

welcome google cloud first time
  1. Click "Select a project"

    select project
  2. Click "NEW PROJECT"

    new project
  3. Type in your project name

    project name
  4. Click create project

    create project
  5. Select "APIs & Services > Library"

    select library
  6. Type "google analytics data-api". Then, click to select.

    find ga data api
  7. Click "Google Analytics Data API".

    select google analytics data api
  8. Click "ENABLE" to enable Data API.

    enable data api
  9. Click "Credentials" in the sidebar

    click credentials
  10. Click "CREATE CREDENTIALS", choose "Service Account".

    choose service account
  11. Type in any name you like. You will see an email address under "Service account ID"

    laramagz@laramagz-395905.iam.gserviceaccount.com

    This email address will be used for roles and data restrictions to access Google Analytics properties.

    create service account
  12. Select the service account email address

    service account created
  13. Click on the "KEYS" tab

    service account details
  14. Choose "Create new key"

    create new key
  15. Select the JSON key type.

    create private key json

    After you click "Create" then you will download the json file, example: laramagz-xxxxxx-z41d06879xz3.json

    saved json

    Rename laramagz-xxxxxx-z41d06879xz3.json to service-account-credentials.json and save it in laramagz/storage/app/analytics folder.

Create a Google Analytics account

welcome to google analytics

Click "Start Measuring" to begin

  1. Type in the account name you want

    create account ga

    Click the "Next" button to continue.

  2. Enter Property Name with any name. Choose your timezone and currency according to your location.

    create property
  3. Select the industry category and business size

    descibe business
  4. Choose your business objectives

    business objective
  5. Select your country/region, check the Data Processing Terms agreement box, click the "I Agree" button.

    ga term agreement
  6. Choose a platform to start collecting data

    start collecting data
  7. Type in the website url and stream name.

    setup data stream
  8. Save the MEASUREMENT ID

    measurement id

    Enter G-DXYY3ZMC09 in the MEASUREMENT ID input in settings > Web Config

  9. Click "Next"

    start collect data
  10. Click "Admin"

    home ga
  11. Click "Property Settings"

    property settings
  12. Copy your property ID

    property id

    Place it in ANALYTICS_PROPERTY_ID in the .env file

    ANALYTICS_PROPERTY_ID=406298333
  13. Click "Property Access Management"

    property access management
  14. Click the plus logo button

    add property access management
  15. Select "Add users"

    add users
  16. Enter the email address that you got when you created the service account, or you can see it in the downloaded json file. Look at the client_email:

    "client_email": "laramagz@laramagz-395905.iam.gserviceaccount.com",

    Select "Analyst" for standard roles.

    add roles and data restrictions