Last week I published an article about Google Analytics API Client Library. I showed there how to use this tool in another application, i.e. how to implement communication and send requests. I mentioned there that I will publish another article where I will explain the configuration and API development process. Let’s start!
I assume that your website is already integrated with Google Analytics, i.e. it is registered and the tracking code is placed, so you can fully use it and review the collected data. Now you have decided that you want this data to go to your other application. In that case, you will use the Google Analytics API.
Steps you need to take:
1. Go to Google APIs & Services and create a new project on this platform.
2. Complete the form below and go next.
3. Now find the Google Analytics Reporting API there and turn it on.
4. Go to ‘Credentials’ and there go to ‘Create Credentials’, select ‘Service account’.
5. Now it is time to complete the visible form, the description field is not required.
6. It is not required to complete the forms on two consecutive tabs, but I recommend creating a key in P12 format. The key file should automatically download, place it in the structure of your project so that you can refer to it later in the code.
7. Now you need to go to your Google Analytics account, where your website is registered. There, go to the admin panel and find the following navigation for your site and click ‘View User Management’.
8. On the panel click ‘plus’ and enter the email address that was generated when creating the service account. You can also set permissions for this account here.
All necessary configuration steps have been completed. Now you can complete the implementation with the required parameters.
Extra tip: It is possible that you will not be able to find the View ID, so this is in the ‘View Settings’ tab.
The configuration process is quite short, but I think some steps are not very clear. Therefore I decided to write this. From here I encourage you to read the previous article, where you will find information on how to implement the communication with Google Analytics API.