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"
-
Click "Select a project"
-
Click "NEW PROJECT"
-
Type in your project name
-
Click create project
-
Select "APIs & Services > Library"
-
Type "google analytics data-api". Then, click to select.
-
Click "Google Analytics Data API".
-
Click "ENABLE" to enable Data API.
-
Click "Credentials" in the sidebar
-
Click "CREATE CREDENTIALS", choose "Service Account".
-
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.
-
Select the service account email address
-
Click on the "KEYS" tab
-
Choose "Create new key"
-
Select the JSON key type.
After you click "Create" then you will download the json file, example:
laramagz-xxxxxx-z41d06879xz3.json
Rename
laramagz-xxxxxx-z41d06879xz3.json
toservice-account-credentials.json
and save it inlaramagz/storage/app/analytics
folder.
Create a Google Analytics account
Click "Start Measuring" to begin
-
Type in the account name you want
Click the "Next" button to continue.
-
Enter Property Name with any name. Choose your timezone and currency according to your location.
-
Select the industry category and business size
-
Choose your business objectives
-
Select your country/region, check the Data Processing Terms agreement box, click the "I Agree" button.
-
Choose a platform to start collecting data
-
Type in the website url and stream name.
-
Save the MEASUREMENT ID
Enter
G-DXYY3ZMC09
in the MEASUREMENT ID input in settings > Web Config -
Click "Next"
-
Click "Admin"
-
Click "Property Settings"
-
Copy your property ID
Place it in ANALYTICS_PROPERTY_ID in the .env file
ANALYTICS_PROPERTY_ID=406298333
-
Click "Property Access Management"
-
Click the plus logo button
-
Select "Add users"
-
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.