Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Which Google Client Cloud Library is used for Universal Analytics API

I’m rebuilding some python code to download UA data. I have previously used the Google API client library (https://pypi.org/project/google-api-python-client/) and specifically this code fragment from Google’s examples to create the analytics object for the report

from apiclient.discovery import build

def initialize_analyticsreporting():
 
  credentials = service_account.Credentials.from_service_account_file(
        KEY_FILE_LOCATION, scopes=SCOPES)

  # Build the service object
  analytics = build('analyticsreporting', 'v4', credentials=credentials)

  return analytics

The Google API Client documentation now says that they now recommend using Google’s Cloud Client Libraries for Python – which would be great as the API library is huge and ultimately this will end up as an AWS Lambda so space is at a premium.

The problem is I cannot find any documentation on which library (if any) I should be using for UA access.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Anyone have any pointers?

>Solution :

You should continue to use the Google apis python client library for accessing all google discovery services apis. Of which the google analytics reporting api is one of them.

All newer libraries that are not listed under the google apis discovery services apis can be found as part of the cloud libraries. For example to extract data from the from GA4 you will be using the google analytics data api. which falls under the cloud library.

So continue using the library you are now, until you want to extract data from ga4.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading