I am using Google Calendar API to create/modify recurring events
for e.g. - there is an event (Say ABC) having recurring events on Monday, Wednesday & Thursday till 31st January 2021 (say 30 occurrences). While creating this event, I calculated number of US holidays coming in this schedule (suppose 1) and increased the COUNT by that number (which will be now 31) and later delete those instances which were occurring those holidays (like 26th Nov, 27th Nov, 24th December etc). Everything works fine till here.
Now I've to add an attendee to this event which I'm able to do by sending a PATCH request (reference) with updated attendees list. This updates the attendees list but it undo's the instances that I deleted. I want recurring event to remain as it is.
TIA
After succesfully deleting the spare event instances, you should be able to add invitees to the non-deleted instance by specifying the recurringEventId as eventId
If for whatever reason this is not working as intended you can perform the following workaround:
Use the method Events: instances with the option showDeleted:false to retrieve the ids of all not deleted event recurrences
Use the method Events: patch in a loop specifying as eventId all single event ids retrieved in the step above
Mind:
While the recurringEventId should look something like qgthctibhb7755q02hnm3cdb3s, the id of each single instance should look something like qgthctibhb7755q02hnm3cdb3s_20201104 (the date is included in the id)
Related
We only want to show our live chat tag Monday to Friday, from 09.00 until 17.00. Is this possible with Google Tag Manager please?
Thanks!
Preferred solution
The best solution is probably to get the current date on the server side and push to the datalayer a variable that determines whether the chat tag should be triggered or not depending on this date.
Alternative
The alternative is to retrieve the date on the client side which won't be 100% reliable. In order to use this solution, you need to create a Custom Javascript variable with the following code (replace "America/New_York" by your business' timezone) :
function (){
const currentDate = new Date(new Date().toLocaleString("en-US", {timeZone: "America/New_York"}));
const day = currentDate.getDay()
const hours = currentDate.getHours()
return day > 0 && day < 6 && hours >= 9 && hours < 17
}
Then, trigger your chat tag only when this variable's value is "true".
If you want to get a consistent, reliable date, ListenLayer.com returns a timestamp with every data dataLayer push. The time can appear in a single account timezone based on your account settings, so if you align your ListenLayer timezone to your chat time zone it will work.
You can then write rules in the platform to determine if the time returned should allow for chat. You will output a yes/no into a new data layer variable based on the rule. Then you will register this variable in GTM and use it to determine if the chat tag should fire.
Here is the process I would use at a high level
Create an account and set the account time to match your chat timezone
Turn on the User Source Listener and all it's features,
enable it to push on every page load This will push the user's traffic source into the data layer, along with a bunch of other structured data on each page load. You could use another listener, but this one will allow us to ensure it pushes on every page load (container load) so that GTM will know on every page load whether to trigger the chat script.
Create a custom data layer variable called chatTime. We will write a rule in ListenLayer to push a yes or a no into this variable based on the time that is returned in the userSource data layer event. This will happen in real time, in the same event in the data layer.
Publish everything in listenlayer and then go to your website with the console open (the data layer is written there for ease). You'll see the userSource dataLayer event in the console on every page load. It will contain an eventTimestamp. You want the data that is inside the listenlayerAccountTime node because it will match your ListenLayer timezone, which should match the timezone you operate your chat hours from (or if all of this is based on the user's time zone, use that one to be localized to them). You will need to focus on these two variables that are automatically provided because we will write a rule based on them in step 5:
sourceAutomaticValues.eventTimestamp.listenlayerAccountTime.time.timeOfDay
sourceAutomaticValues.eventTimestamp.listenlayerAccountTime.time.dayOfWeek
Here is a visual showing those variables I have given a path to above. One of the day of the week and one is the time of day.
Inside ListenLayer, under the User Source listener you will create two rules, they will be lookup table rules. The first rule will run first, then the second. If a match is found, they will stop. This means we can write the first rule to basically just look at the day of the week and set chatTime to no if the value is Sat or Sun. The second rule will then focus on the time of the day since this rule will only be reached if it is not Saturday or Sunday. In this rule we will look at the first part of the timeOfDay variable using simple ReGex. Our rule has 24 rows for each hour of the day and will return a yes only for the hours you are open for chat. Certainly this rule could be made simpler with some additional regex, but this gives a better illustration. There is an import export so you could spin up the 24 row rule in a csv file and import it.
After you save and publish this simple logic, your website will have a value in the data layer telling google tag manager whether chat should be on. It will appear in the data layer every time the userSource event is pushed, which is every page load.
I assume things are easy from here. You would create a data layer variable inside GTM referencing sourceCustomValues.chatTime You'll also create a custom event trigger referencing userSource and only firing if chatTime = yes. Then you will set your chat tag to fire on this trigger.
I'm using fullcalendar resource schedular plugin trial version. I set a month view. I want to disable click event for days [Monday, Wednesday, Thursday and saturaday] of every month. So end-user can't book resources for those days.
I will suggest to use selectAllow function and inside the function write your logic which time to allow and which time to disallow user select on a slot.
https://fullcalendar.io/docs/selectAllow
I am using the following API to get the events from Microsoft Calendar:
https://outlook.office.com/api/v2.0/me/events
I only need the events for today and tomorrow, hence I put a date startDate and endDate in the URL above.
Now If I create a recurrent event on say today (occurring daily at 4:00 PM for example), I get all the information on that event that is returned in a recurrent JSON key.
I do not get the same event the next day.
Is there any API that returns all the ids of recurrent event for a range of dates or current month?
Use https://outlook.office.com/api/v2.0/me/calendarview?startDateTime={start_datetime}&endDateTime={end_datetime}
Would there be a way to limit the next/prev buttons to only show months with events registered in them? We have courses that fill up and I don't want users to have to fast forward through blank months where there is no availability of events. I'm also including holiday events from the basic google public holidays calendar and don't want to include those events.
As long as I know, this option does not exist in FullCalendar yet.
If you are retrieving events month by month:
You can bind fullcalendar's Next and Previous events to a new function. Inside this function, get the events and if there is no events, your function must call Next or Previous again.
If you are retrieving all events at once
You can bind fullcalendar's Next and Previous events to a new function. Inside this function, get all the events and look for the first date out of the current month. Set fullcalendar's current date for that month and refresh it.
What is the proper way to update all (or a subset) of the instances of a recurring event? Also related: how do you, given the id of the original event, get the instances of that event?
If you want to update just a subset of recurring events, then you need to set singleevents = true when running your query to retrieve the initial list of events. In PHP you'd do something like this
$gdataCal = new Zend_Gdata_Calendar($client);
$query = $gdataCal->newEventQuery();
$query->setUser('default');
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setStartMin($startDate);
$query->setStartMax($endDate);
$query->setSingleEvents('true'); //get recurring events as a series of single events
$eventFeed = $gdataCal->getCalendarEventFeed($query);
foreach ($eventFeed as $event) {
//do stuff with $event
}
I tried with updating all recurrence event ,it is working.Initially I created one Recurring event like weekly on Monday from 2016-02-25 to 2016-03 25 and It is created 6 instances for that recurring period.During updating what I tried is,
1.First I assigned to Recurrence field ,
"recurrence":["RRULE:FREQ=WEEKLY;COUNT=18;BYDAY=TU"] (Updating like weekly on Tuesday)
2.after that I fetching available lists using list google api.here I used Single Events: false(in the sence it will give only main recurring event not all instances)
3.after I used update event to update like passing auth,eventId and calendarId: "primary" and resource:updated event array
then it is done .It is updating the instances as Weekly on Tuesday.
I hope it will help to someone.
To update all you just change the relevant properties for the event, leaving the recurrence and recurrence exceptions strings intact. Not sure that you can easily modify a subset, as this would require converting the recurring event into multiple new events depending on the subset.
For the second part or your question, according to the API docs:
Specifically, each recurring event is
represented by a
element in the result feed, and each
of those elements includes a
element for each occurrence of that
event that falls between the start
time and the end time. Looking at
elements is much simpler
than parsing recurrences and
exceptions yourself.
However, I've never been able to find that magic "when"... so I've ended up parsing the recurrence and recurrenceexceptions strings - if you find the answer to that one, let us all know!
For anyone with this issue I also spent some time trying to figure this out. Basically when you get your CalendarEventEntry list you need to check for each calendarEventEntry if it has an originalEvent (calendarEventEntry.getOriginalEvent()). This basically tells you there is another event (which you may or may not have already processed) that needs to swapped with the information for this current calendarEventEntry.