How does google calendar knows which events to include in sync? - google-api

I want to sync the events in my server side application with Google calendar events. I read about https://developers.google.com/google-apps/calendar/v3/sync but I'm not sure how it selects events? Are they per developer application or per user or per user or per user per calendar? or something else? If it is per user, is there any way to get all the changes for events created withmy application or associated with users of my application?

Related

How to be aware of the creation of a new event in a google calendar? [duplicate]

I am developing a SPA webapp through which I add events to my users google calendar They have given permission for. However this is my first time using Google calendar API, and was unclear about how to retrieve my users existing events , or if they add new events or delete them. IS there an option to set a webhook within google calendar thus when the user makes any changes to the calendar I can receive the change. My current approach was to make multiple get requests but that seems very inefficient. How can I keep my app calendar in sync with all user created events.
You can set up a push notification to be alerted any time anything changes on one of your calendars. I looked into it before a little, if memory serves it doesn't alert you to a lot of particularly useful information (I don't believe it tells you exactly what changed and how). Check out the docs here: https://developers.google.com/google-apps/calendar/v3/push
What I ended up doing was setting up a cronjob and getting all of my calendars' events using the synctoken, which returns only the events that have changed since the last time I polled the API for events. https://developers.google.com/google-apps/calendar/v3/sync
If you are using the SyncToken in your request for data, all you get back is the events that have changed. There is an eventID in the Google records that you can use to connect the change to your event data.

Track a Google Analytics event that occurs when a user isn't on the site

Our site enables users to send money to us via a bank transfer. They 'initiate' the transfer and get a reference code. Then they log in to their bank account and send the money using the reference code.
We track when a user promises to send the money but I'm not sure how to track when that money arrives. They won't be logged into the site when it happens which makes it complicated. Is there a way to do this?
Thanks in advance!
It is possible to track events on behalf of a recent user, but it requires coding on server side. You need to use the Google Analytics Measurement Protocol
to create this event, when you are notified about a successful transfer. You can send all relevant information to Google Analytics, like event category, action, or event value (e.g. transfer amount), or even track these as ecommerce transactions.
You can check the parameter reference to learn about the required and optional parameters to be sent with your hit. You can also experiment with such custom built hits with the Hit Builder tool.
If you would like this event to be connected to your existing user, then you'll also need to store your visitor's client ID during their visit, and later reuse this client ID in your backend-initiated Analytics hit.
Here is an example for an event hit for a recently stored ClientId, with given event attributes, including value.
There a few things to be considered in such scenarios, or at least to be aware of. Such events will generate additional hits in your Analytics property, and also initiate sessions, which can alter your various Analytics metrics, if their volume is comparable to your overall traffic.

Is there a limit to the number of calendar events that can be programmatically scheduled for a given user?

My web app has an event scheduling feature, and I'd like to automatically create, update, and delete calendar events from users' individual calendars as the event details change on my site.
My plan to do this is to set up an automated/service user (e.g. events#example.co) and use the Calendar API to send invites that come from that user. As the event gets updated I continue to use the API through that user (using a server-to-server authentication protocol, so no human authorization required) to modify the event and deliver updates
If I'm scheduling several thousand events - will this scale with just one user? It doesn't feel right to schedule so many events under one automated user. But then again, it might work just fine.
Is there a limit to how many events I can schedule?
Is there a more sane way to approach this overall?
Thanks!
The google calendar api applies some standard quota limits on you. Basically the number of requests that you can make. However when you are planing on using a single user then there will be some other rules you will need to consider
Copied from here
If a user has created more than 10,000 events in his or her calendar within a short period of time, that user might lose calendar edit access.
If a user creates more than 25 new calendars within a short period of time, that user's calendar might go into read-only mode.
In order to prevent spamming, Google Calendar limits the number of invitations a user can send to external guests. This limit varies depending on the action, and is usually between 100-300 guests.
You can do this using a service account. To my knowledge there is no limit to the number of events you can put in a calendar per day however as stated above there will be a limit to how many you can insert at once.
I am not aware of a more sane option than this sorry.

Google Calendar event Created/Updated/Deleted Webhook?

I am developing a SPA webapp through which I add events to my users google calendar They have given permission for. However this is my first time using Google calendar API, and was unclear about how to retrieve my users existing events , or if they add new events or delete them. IS there an option to set a webhook within google calendar thus when the user makes any changes to the calendar I can receive the change. My current approach was to make multiple get requests but that seems very inefficient. How can I keep my app calendar in sync with all user created events.
You can set up a push notification to be alerted any time anything changes on one of your calendars. I looked into it before a little, if memory serves it doesn't alert you to a lot of particularly useful information (I don't believe it tells you exactly what changed and how). Check out the docs here: https://developers.google.com/google-apps/calendar/v3/push
What I ended up doing was setting up a cronjob and getting all of my calendars' events using the synctoken, which returns only the events that have changed since the last time I polled the API for events. https://developers.google.com/google-apps/calendar/v3/sync
If you are using the SyncToken in your request for data, all you get back is the events that have changed. There is an eventID in the Google records that you can use to connect the change to your event data.

Is it possible to update multiple calendars using google calendar api

I want to allow users of my site to schedule an appointment with other users. Once both users agree on the date and time it will update both their calendars to show this (assuming they are authenticated).
Is this possible or is the Calendar api simply for updating one calendar as an authorized user?
Thanks in advance!
As long as the user / users you are updating calendars for have both authenticated your application yes you can add events to their calendars.
A few things to note I the beginning. There is a difference between a calendar list and a calendar. Calendar list is the list on the left hand side of all of the calendars a user has. A user can have more then one calendar so be sure to ask the users which calendar they will want to add the event to.

Resources