Tockify Embedding API Documentation

The API For Embedding Tockify in Your Site

These notes are mostly for advanced users

Most people will be able to embed Tockify in their site using the embed code generated by the customization tool or using a plugin for their website. This page gives extra details for people who want more control.

Before you can use the Embedding API you must first either install a platform specific Tockify plugin or add the Tockify embed script to your page:

<script data-cfasync="false" data-tockify-script="embed"
src="https://public.tockify.com/browser/embed.js"></script>

You can now use the embedding API to add Tockify and control how it appears. For a generic site the easiest way to add the Tockify calendar is with the following:

<div data-tockify-calendar="spirited" data-tockify-component="calendar"></div>

The data-tockify-component="calendar" attribute says that we are embedding the calendar component and the data-tockify-calendar="spirited" attribute identifies the calendar to embed.

Alternatively, to embed the mini calendar use:

<div data-tockify-calendar="spirited" data-tockify-component="mini"></div>

For WordPress users the equivalent code using the shortcode provided by our WordPress plugin is as follows:


        [tockify component="calendar" calendar="spirited"]
    

The equivalent for the mini calendar is:


        [tockify component="mini" calendar="spirited"]
    

The other attributes you can use to control how the calendar is embedded are listed below:

  • data-tockify-search (or just search in WordPress). This pre-fills the embedded calendar's search box with the attribute's value
  • data-tockify-tags (or just tags in WordPress). This is a comma separated list of tags to pre-filter the calendar by.
  • data-tockify-view (or just view in WordPress). The default view for your calendar can be set in the theme customizer. This attribute lets you override the theme setting. The value can be pinboard, agenda or monthly
  • data-tockify-path (or just path in WordPress). This lets you open the calendar on a particular event page and can only be used when component="calendar". For example:
    <div data-tockify-component="calendar"
      data-tockify-path="/spirited/detail/557/1449050400000"></div>
  • data-tockify-width (or just width in WordPress). This limits the calendar's width. You need to include units, e.g. 400px or 50%. It's usually better not to set this and limit the width using your own wrapper div.
  • data-tockify-height (or just height in WordPress). This limits the calendar's height and adds a scrollbar when it won't fit. You need to include units, e.g. 400px or 50%. This is usually a bad idea and should be seen as a last resort if you are having problems with the calendar being clipped or overlapping some other content on your site (some website builder tools make HTML with these problems).

Calling the API from JavaScript

We also provide a simple JavaScript API for launching the popup (lightbox) calendar. This is included in our embed script (see above).


         _tkf.openFullScreen({name:'spirited'});
     

Here _tkf is the global namespace for Tockify JavaScript functions. The name parameter identifies the calendar. You can also add a view parameter with values pinboard, agenda, or monthly view to control the view that the calendar shows first when it opens.

If you want to open the popup calendar on a particular event page use this instead:


          _tkf.openFullScreen({path:'/spirited/detail/557/1449050400000'});