Jump to content

Recommended Posts

Posted

Hi all,

 

I am trying to add a button to my website that allows customers to 'subscribe' to our calendar.

 

Currently, the button just downloads the .ics file and adds the events in our calendar to the customers own calendar but doesn't automatically update when we add new events.

 

Has anyone successfully added a 'subscribe' button that will actually grant customers access to our calendar where they will receive live updates?

 

Any help would be very much appreciated.

 

Thank you!

Posted (edited)

Hi there,

 

I've had a lot of .... fun implementing this functionality. The main problem that you will come across is that you have no control over how frequently or infrequently Google polls the calendar feeds. Typically it seems to poll about once every 24 hours which is far from ideal. You will struggle to get it fully-live. There are solutions out there that can help you with this but you will still find yourself up against how infrequently Google imports the data.

 

That caveat aside, there is an undocumented method of requesting that Google add a calendar, which is that you send the user to the following URL (if you click this you will see it try to add the dummy URL as a calendar):

 

https://calendar.google.com/calendar/render?cid=http://www.yourdomain-here.com/some/link/to/an/ics/file.ics

 

Here's where it gets a little complicated. First up, Google does not accept a https URL there. It will successfully redirect http to https though so don't worry about that if your webserver is set up to properly redirect. Secondly, especially if you have any url parameters, make sure that your cid parameter is properly URI encoded. Finally, Google Calendar likes to just not do anything if the ical feed does not validate. Expect to spend a long time tweaking your feed to get it to validate just right for google. If you search around you can find plenty of online tools to validate your data though. I recommend using at least a couple of them, as none of them seem wholly reliable however if you can get your feed to validate in more than one you're probably on the right tracks.

 

This method used to be documented but all aforementioned documentation seems to have disappeared from the internet a couple of years ago.

 

There is a second way which can potentially work but relies on users clicking the right buttons in their browser. If you direct the user to webcal://www.yourdomain-here.com/some/link/to/an/ics/file.ics then, depending on their browser settings, that will get picked up by their calendar software. There's also an option for Outlooks web client but that's another story.

 

Good luck!

Edited by SimonHooker
  • Thanks 1
  • 3 months later...
Posted

How about this? This is what we do to publish our terms dates for anyone to add to Google Calendar.

 

In Google Calendar:

  • Share this Calendar (drop down next to the calendar name)
  • Make this calendar public (tickbox)
  • Calendar Details
  • Under Calendar Address, grab the HTML link.

The HTML link shows the calendar as a webpage, but there's a "+Google Calendar" button in the bottom right which will allows the user to add the calendar to their own Google account (i.e. subscribe to it). It all works nicely if they add their Google account to an iPhone, Mac, etc.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...