G Suite list of calendars per user - google-calendar-api

I have a G Suite setup, with a couple of calendars and users added to those calendars. Is there a way to retrieve a list of calendar ids per user (where they have access to)? So I can add those calendars per user in our new to developed system.

There are two things you can do:
Use the method Acl;list to retrieve for each calendar the respective
scopes and roles of users/ groups/ domains
Use a service account to impersonate subsequently all users of interest and list their calendars on their behalf.

Related

Firebase Analytics: Manually return a user's audiences

I want to write a firebase cloud function that returns a value based on the analytics audiences the user belongs to. To that end I need a way, either on the front end or the backend, to manually query what audiences a given user belongs to. Is there any way to do this in firebase?
I don't think is currently possible.
Audiences are used to :
Filter reports so you can analyze how different user segments engage with your app
Target Notifications to individual audiences
Target Remote Config to deliver custom experiences to different audiences
In the case of reports you can add a filter based on single user property such as age or gender but not for an specific user.

Automatically Subscribe all users to Super Admin Google Account

I need one super admin account to be able to view all Google calendars for all users in the organization.
To do this manually I would do the following:
Repeat for all users:
Using my super admin account go to https://calendar.google.com/calendar
Click on subscribe calendar and enter the email of the user
I want to automate this process using Google APIs.
Fetch all users in the organization
If I have not subscribed already then subscribe
Is it possible to do this via Google APIs? I was unable to find documentation on subscribe in Google Calendar API
You can add calendars to your super admin account from other users by using the method CalendarList: insert as this will add a specified calendar to your calendar list.
To get the calendar id required to insert this calendar into your calendar list you could use CalendarList: list and impersonating each user on your organization to then iterate over this list of calendars to get the id. I recommend doing this process using a service account.
Create a service account.
Iterate over each user on your organization.
On each user make a CalendarList: list call and iterate over each calendar of this list.
For each calendar use CalendarList: insert to insert this calendar in the super admin (or any other user) account.

Google calendar api - how to give an outside user the role of the organizer

We have a service account creating meetings from our node.js backend. Each meeting has a Google Meet link generated. Attendees are NOT associated with our gsuite account.
However, each attendee is required to “ask to join” the meeting when they click on the Google Meet link.
With the service account, when the meeting has been created the creator and organizer are both automatically set to the service account user despite the parameters that passed in the “insert” function.
We need to generate meetings and assign the role of the organizer to one of the attendees to give one of the attendees the privilege to start the meeting and let the other attendees in. How can we do this?
Two things:
If you user a service account - the only type of delegation that is possible is domain-wide delegation. In other words, the service account is not able to impersonate a user who does not belong to the same domain.
If you do not user a service account with impersonation - the creator / organizer of an event is the person who runs the code to create the event. Those properties are readonly and cannot be modified - see here.
Now, as for letting external users join a Google Meet without approval - have a read at the information provided by Google:
Who needs to request to join a video meeting?
People who aren’t added to the Calendar event.
Web users only - People who don't have a Google Account. This is applicable for meetings created by G Suite users. For any meetings created by non G Suite users, you will need a Google account to request joining the meeting.
G Suite users only: People outside your organization who use G Suite for Education. Anyone in the meeting can grant access. Someone from your organization in the video meeting can also grant access.
Provided that the guests confirmed their participation in the event, I recommend you to contact GSuite support to troubleshoot why your invitees are not able to join the meeting without approval.
WORKAROUND
Consider creating an account in your GSuite domain for the users whom you would like to allow to join wihtout aproval.

Can multiple Google Analytics account have same profile ID?

Is is possible that multiple Google Analytics accounts (e.g abc#gmail.com and xyz#gmail.com) have same profile(view) Id or is it unique across all the Google Analytics accounts?
I am sure that web property is unique (as it is used to collect data from web/app) across multiple GA accounts but I am not sure about the profile IDs.
Here is the use case:
I am developing the web application which allows any user on internet to authorise his/her GA account and extracts the data from GA. The web application uses GA Reporting API V4 and performs caching mechanism based on Google Analytics username (i.e. abc#gmail.com).
Now let's profile ID 123 from abc#gmail.com is shared with xyz#gmail.com and both the users wants to extract the same data for same profile 123 from GA. Now since the caching is done on GA Username, web application will consider it as two different requests but if caching is done on profile id, only one of the two requests will be considered as new request and the other will be served from cached result. That is why I need to know whether GA profile ID is unique across multiple Google Accounts or not considering profile ID is not shared with any other account.
===== Edit =====
I have asked the same question to Google Advertiser community. Here is the link for reference.
https://www.en.advertisercommunity.com/t5/Google-Analytics-Account-Access/Can-multiple-Google-Analytics-account-have-same-profile-ID/td-p/888552
Correction:
Google analytics accounts are not based upon a single gmail address.
When abc#gmail.com logs into the Google Analytics website they may have one or more Google Analytics Accounts listed. Google Analytics accounts can be websites or mobile data based. A user can be added to more then one Google analytics account.
Lets say abc#gmail.com has a website. Superwebsite.com they create a google analytics account for tracking of that website. Now abc#gmail.com would like to share the data in that google analytics account with a new employee xyz#gmail.com. abc#gmail.com simply needs to add xyz#gmail.com as a user and they both have access to the Google Analytics account.
Answer:
A google analytics account id looks like this 59183475 and yes is probably unique Globally across all google analytics accounts. Web properties are used to actually insert the data into google analytics and look like this UA-59183475-1 they are also unique globally.
There is no way to know for sure unless you ask someone at Google. However I suspect that profile id is some kind of composite primary key. being that it will be unique across account - web property - profile id. I have no way to prove that its just a guess on how I would create the database personally.

How can I generate a GA tracking code programmatically?

How to generate Google Analytics tracking code programmatic-ally?
I am new to Google Analytics API, can someone please help
It is NOT possible to create new Google Analytics accounts or profiles programmatically using the existing APIs.
There are two APIs available, the Data Export API and the Management API. However, they are bot read-only.
With the Google Analytics Data Export API, you can develop client applications to request data from an existing Analytics profile for an authorized user, and refine the results of the request using query parameters. Currently, the Data Export API supports read-only access to your Google Analytics data.
Currently, the Management API supports read-only access to five components of the Google Analytics Management system: Account data,Profile data, Web property data, Goal data, Advanced segments
Seems like it's finally possible in 2021 with alpha api.
https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/create#authorization-scopes
It's not currently possible to create Google Analytics accounts automatically at the moment but generating the tracking code is possible.
The only real variation between the tracking code generated each time you create a profile for a new domain is the web property ID. This is in the format UA-XXXXXXX-X. Each X is a number - the first 7 numbers are the account number and the number after the last dash relates to each web property set up for the account.
You can use the accounts feed of the API to get a list of accounts and their profiles. If an account only has one profile then it's possible to use the web property ID of it to automatically generate the tracking code. However, if there's multiple web properties then you would need a way to decide which one to use (present the user with a selection list etc).

Resources