We rebuilt our website from scratch and are still updating some extensions and pages. Having a problem? Sign in and open a support ticket or contact us.
JoomBoost

Google Calendar

Easy Calendar can colour a calendar's days from the events in a Google Calendar. If your bookings already go into Google Calendar, the website then shows them without any typing.

The sync is one way and read-only. Easy Calendar reads events from Google. It never adds, changes or deletes anything in your Google Calendar.

How it works

  1. Fetch. On a schedule, or when you click Sync now, Easy Calendar reads the events of the coming days from Google and stores a copy in your database.
  2. Split the day. Each day is divided into 1, 2 or 3 time blocks, for example morning and afternoon.
  3. Free or booked. A block is booked when any event overlaps it, even a short one. Otherwise it is free. Together the blocks make the day's pattern, for example "booked, free".
  4. Colour. Easy Calendar looks up the pattern in the calendar's legend mapping and shows the day in that legend item's colour.

Visitors always see the stored copy. The page never waits for Google, and it is as fresh as the last sync.

Part 1: set up Google (once)

Easy Calendar signs in to Google with a service account, a robot account that can read the calendars you share with it.

  1. Open the Google Cloud Console (console.cloud.google.com) and create a project, or pick one you have.
  2. Go to APIs & Services > Library, search for Google Calendar API and click Enable.
  3. Go to APIs & Services > Credentials > Create credentials > Service account. Give it a name and create it.
  4. Open the new service account, go to the Keys tab, and click Add key > Create new key > JSON. A .json file downloads. Keep it safe.
  5. Copy the service account's email address. It looks like [email protected].
  6. In Google Calendar, open the settings of the calendar you want to sync. Under Share with specific people, add the service account's email with the permission See all event details.
  7. In the same settings, under Integrate calendar, copy the Calendar ID.

Without step 6 the sync fails with a "not found" error even though the key is valid: the service account only sees calendars shared with it.

Part 2: connect the calendar

Go to Components > Easy Calendar > Calendars, open the calendar and go to the Google Calendar tab.

Field What to enter
Enable Google Calendar sync Yes. The other fields appear
Google Calendar ID The Calendar ID from step 7
Service account key (JSON) Choose the .json file from step 4. It is read in your browser and saved in the database with the calendar, never as a file on the server. Later the field shows "(stored key)". Leave it alone to keep the key, or click Replace key
Calendar timezone The time zone the events are compared in. Leave - Use Joomla site timezone - unless the place is in another zone
Time blocks per day 1, 2 or 3, see Part 3
Block 1 ends at / Block 2 ends at The times between the blocks, as HH:MM
Legend mapping The legend item for each pattern, see Part 4
Fallback legend See Part 5
Manual editing while synced See Part 6

Click Test integration after you enter the Calendar ID and the key. Easy Calendar connects to Google and shows the calendar's name, its time zone and how many events it found in the next 30 days.

Then Save. When you save with sync enabled for the first time, Easy Calendar adds four legend items to the calendar if they are missing (Free, Booked AM, Booked PM and Fully Booked) and fills the legend mapping with them. Your own legend items stay.

Saving does not fetch events. Click Sync now on the Google tab, or in the calendars list, to fetch them for the first time.

Part 3: time blocks

A time block is a part of the day that is judged free or booked on its own.

Blocks Example split Meaning
1 none The whole day: booked if any event touches it
2 15:00 (default) Before and after 15:00, for example check-out and check-in
3 15:00 and 17:00 (defaults) Day, late afternoon and evening

Block 2 ends at only appears with 3 blocks. An event that ends exactly at a split time stays in the earlier block, and one that starts exactly at it belongs to the later block. An event that crosses a split time books both blocks.

All-day events and events over several days book every block of each day they cover.

After you change Time blocks per day, save the calendar: the legend mapping table redraws for the saved number of blocks.

Part 4: legend mapping

The legend mapping table has one row for each possible pattern: 2 rows for 1 block, 4 for 2 blocks, 8 for 3 blocks. Each row has one column per block, earliest first, and a legend item to show.

With 2 blocks, the starting mapping is:

Block 1 Block 2 Day shows
free free Free
booked free Booked AM
free booked Booked PM
booked booked Fully Booked

Booked AM and Booked PM split the day across the middle: the top half for the first block, the bottom half for the second. With 1 or 3 blocks, the all-free row starts as Free and every other row as Fully Booked. Change any row to the item you want.

If the table says "Save the calendar first", save the calendar with sync enabled, then come back to the tab.

Part 5: fallback legend

The fallback legend is used when a pattern has no legend item in the mapping, or when the mapped item was deleted. If the fallback is missing too, Easy Calendar uses the calendar's first published legend item. When you delete a legend item that a mapping uses, Easy Calendar removes it from the mapping and shows a warning.

Part 6: manual editing while synced

Choice What you can do by hand
Locked (default) Nothing. Google controls every day. Days cannot be clicked and Quick Edit is hidden
Fill gaps Edit days with no Google event. On days with an event, Google wins
Override Edit any day. Your status wins over Google on that day

This applies in the administrator and on the site. Super Users see a short note under a synced calendar on the site that says which mode it uses. Other visitors see a plain calendar.

Keep it in sync

Sync now

Click Sync now next to the calendar in Components > Easy Calendar > Calendars, or on the calendar's Google tab. The list shows when each calendar was last synced, Stale (>24h) when that was more than a day ago, and Sync error with the message when the last sync failed.

  1. Go to System > Manage > Plugins, search for EasyCalendar - Google Calendar Sync and enable it. The package installs it disabled.
  2. Go to System > Manage > Scheduled Tasks, click New and choose EasyCalendar: Sync Google Calendar events.
  3. Set how often it runs, for example every 30 minutes, and save. The task has no settings of its own: it syncs every calendar with Google sync enabled.
  4. Make sure Joomla's scheduler runs. By default it runs when people visit the site (lazy scheduler). On a quiet site, call the web cron URL or run php cli/joomla.php scheduler:run from a server cron job.

How far ahead

Each sync reads from yesterday up to the Sync window (days) in Options, 90 days by default and up to 730. Days beyond the window show the default status, so set the window at least as long as people book ahead.

Good to know

  • Every event that is not cancelled counts, also events shown as "Free" in Google. Keep a separate Google Calendar for bookings, so private appointments do not block days.
  • Repeating events are read as single events, so each one books its own day.
  • Days before yesterday are not read from Google. With Show past days off, as by default, past days are greyed anyway.
  • The dashboard counts only statuses saved in Easy Calendar, not days coloured by Google.

Troubleshooting

What you see What to check
"The uploaded file is not a valid Google service account key" Use the JSON key of a service account (Part 1, step 4). It must contain client_email, private_key and token_uri
"this key's token_uri is not Google's OAuth endpoint" The file is not a genuine Google key. Download a new one from Google Cloud
The test connects but finds 0 events, or says "not found" The calendar is not shared with the service account email, or the Calendar ID is wrong (Part 1, steps 6 and 7)
All days are free after setup No sync has run yet. Click Sync now
Days have the wrong colour Check the calendar timezone, the split times and the legend mapping rows
The mapping table has the wrong number of columns Save the calendar after changing Time blocks per day
The calendar is out of date Check the Sync error in the calendars list, and that the plugin, the Scheduled Task and Joomla's scheduler run

All Extensions