Adding a Automatic Google Calendar Link to an Event in Nationbuilder

A common feature of event pages is to have a link in which an end user can quickly add said event to their Google Calendar. Below is a snippet of HTML/Liquid code that does that in an updated way, taking full advantage of new and improved Nationbuilder page and event variables. The snippet also uses a full ranges of prepopulated fields that Google Calendar supports. I hope you enjoy this quick fix, and if this helped you out -- please consider sharing this article on social media.


 

 

An explanation of some of the parameters...

text

This pulls in the headline of your event

ctz This one is tricky. Google only accepts very specific formatted time zone codes, which Nationbuilder doesn't generate automatically. Here's a list of what's accepted. This code uses ET because that's my default - but to swap it you'd insert in the code that your event time zone is. Here's a compatible list of zones for the US.
dates Google has to have a start date and end date to auto-populate, and it needs to be in UTC format. This is all done for you for your event through Liquid.
location Pulls the Address you put in your Event Venue/Location settings

sprop=name

Just a attribute for the Website Name
sprop=website Just a attribute for the Website Address
details This is where your Event content gets pulled in. All HTML tags are stripped in order to pass through the URL better.
target="_blank" One last added attribute to the <a> element to force the link to open in a new tab, just so you don't loose visitors on your website completely.

 

If you have any questions, or want to do something like this but a little more complex on your site -- please contact me at [email protected]ail.com.