If you’ve been with us through the entire series, welcome back! This time we’ll get in and get our hands dirty in some code. If you haven’t been with us for the series, start by reading the first part of the series, which discusses some background, and the second part of the series. We also have added the third part of the series which prefaces today’s lesson.
The next step in the process is to start editing and uploading the files. Before we begin editing files, we must first get the information to place in the files. This part is mainly Google’s authentication.
Google uses Auth 2.0 with a special token to authenticate a user. If you have ever allowed an app to access your Google information, this is the same process. When you use a Google app, which is what we will be developing, it will first request access by you. This will require a Google login from the account you wish to use the app with. Then, it will ask for your permission for the app to access your account. Finally, it will return an authorization token to the application. This token has an expiration. It also may expire early depending on your browser settings.
To get your information for authorization, head over to the Google API Console. When in the console and logged into the appropriate account, click the dropdown in the upper left hand corner to create a new project. Name the project any name you choose.
Once you have created a project, navigate to the services page. Ensure that you turn on the Analytics API. Once you have completed that, click the ‘API Access’. This will take you to an area where you can generate the keys you will need.
For our purposes, we’re going to be doing a web application. We are still working in PHP for this project. All of the demonstrations will be live and on the web. Input the appropriate information here.
After you have submitted the client ID settings, you’re done! You will be redirected to the API access page, where you can see all of the information.
Luckily, you can’t exactly break this one. However, as we move forward with more coding, you will need to keep an eye on these settings. There are some errors that you may run into that could be caused by the settings you made here.
For the next installment, we will be discussing how to actually implement these items into the previously downloaded code. From there, we will move forward with uploading and testing the application!