s Connecting Google Analytics | Flowcourier Analytics

Connecting Google Analytics

Flowcourier leverages the Google Analytics Data API (GA4) to access vital reporting data. To enable this functionality, you'll set up a dedicated Service Account, which Flowcourier utilizes to securely retrieve and analyze Google Analytics data

Posted by  jp on August 16, 2023

Step 1: Create API Project and Add Service Account

Step 1. Go to Google APIs and create a new project for example "FlowcourierAnalytics" (or use existing project).

Step 2. Click "ENABLE APIS AND SERVICES" in Enabled API's & services

Step 3. Search "Google Analytics Data API", select it and click ENABLE -button 

Step 4. In Manage view if "Google Analytics Data API" click CREATE CREDENTIALS -button

  1. Choose Application data
  2. In "Are you planning to use this API with Compute Engine..." answer No.
  3. Click NEXT -button

Step 5.  Give a name for example: "sa-FlowcourierAnalytics". and press CREATE -button.

 

Step 6. In Google Cloud Console, click credentials on the left menu and copy Service Account Email address.

 

Now you have a Google Cloud -project that can access "Google Analytics Data API" with a new service account.

 

 

Step 2: Give Service Account Access to Google  Analytics property

On the  previous step we created Service Account. Now we want to give this service account read access to Google Analytics property. This is easy as giving access to any user.  If you are not familiar with Google Analytics Access Management you can follow these simple steps below.

Step 1: Fire up your favorite web browser, open a new tab, and go to analytics.google.com.

Step 2: Sign in to the Google account with an Administrator role for the account or property that you want to grant access to.

Step 3: Go to the property in question and click on the gear icon in the lower-left corner of the screen.

Step 4: To grant access to the GA account, click on “Account Access Management.” To grant access to the GA property, click on “Property Access Management.”

Step 5: Click on the blue “+” icon in the upper-right corner of the screen, then select “Add users.”

Step 6: Paste in the service account email address and select their Viewer -role. 

Step 7: Click on the blue “Add” button in the upper-right corner of the screen.

 

Now the service account has access to Google Analytics Property!

 

Step 3 - Add Service Account user to Umbraco 

In this final step we tell Flowcourier Analytics to use Service Account to read data from Google Analytics.

 

Step 1 - Go to Google Cloud Console and in IAM & Admin open Service Accounts. Then click your Service Account 

 

Step  2 - Click KEYS -tab  and then click  ADD KEY > Create new key -button.

 

Step 3  - Choose JSON key type.

 

 

 

 

 

If It Doesn't Work...

If after clicking the 'Finish' button you're getting the 'Invalid grant' error message, please check the following:

  • Your service account has the correct role ('Editor' or 'Owner');
  • You have created the service account under the same Google account you use for Google Analytics;
  • the local time is in sync with the server time (maximum admissible difference is 5 minutes).