To connect Omniscope to Google Analytics 4 and retrieve tracking data, follow this guide.
In Omniscope, add the block
First, add a Google Analytics 4 block:
Open the block by clicking it:
If you're running Omniscope on a server (such as a cloud VM) which has the correct service account credentials already provided, you should be able to skip the following steps and just enter the Property ID.
Enable the Google Analytics Data API
First ensure the Google Analytics Data API is enabled in your Google Cloud project. Go to the APIs and Services page for Google Analytics Data API in your relevant project, and if you don't see "Manage", click "Enable":
Manage the API and create a service account
Otherwise, click "Manage":
Choose Credentials
Click Create Credentials
Choose Service Account
Enter the details. Note down the email address shown below the 2nd input, for later.
Create and Continue. Skip the next 2 optional steps.
Create a key
Go into the newly created service account and add a key:
In the dialog, leave JSON selected and click Create:
A JSON file will download. Keep if safely for later.
Grant access
Now log in to Google Analytics, and go to Admin:
If you have multiple properties, pick the one needed at the top of the screen.
Now go to Property details:
Note down the Property ID, shown on the top-right, a numeric ID.
Now go to Property access management. Click the big blue + icon, choose Add Users.
Paste the service account email address. You can untick "Notify".
Ensure the role Viewer is selected. We won't need more. Click Add:
Phew. We're done with all that.
Now back to Omniscope, and configure a secure location for the key
On your Omniscope server, create a folder somewhere secure outside of the Omniscope files folder, and store the JSON key file from earlier, there.
Next, allow projects to access this folder. (Normally projects can only access files in the Omniscope files folder, but it also means the files could be accessible via the web if Omniscope is misconfigured, so you should never put secret keys in the Omniscope files folder).
In Omniscope, go to Admin > Project Resource Access, and add the folder as a permitted location:
Configure the Google Analytics 4 block
Change the Credentials option to Custom location. Browse for the JSON file. Paste the numeric property ID from earlier. Click Confirm.
You should now be able to execute it and use the data in the rest of your workflow and reports!
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article