Skip to main content
Most King County offices will be closed on July 4, for Independence Day.  
King County logo

Add a calendar to your page with a small script.

HTML

"your-div-id" can be named anything you'd like. Just make sure it matches the variable in your JavaScript.

If you have multiple calendars on your page, you will need unique ids for each one.

<div id="your-div-id"></div>

JavaScript

If you want defaults use:

<script>
$('#your-div-id').eventsCalendar({
  calNum: 'a5hq-yx6s', //Socrata database number *Required
  numItems: 4, 
  title: 'Events',
  titleIcon: 'fa-calendar', 
  allItemsUrl: 'https://www.kingcounty.gov/about/news/events',
  allItemsText: 'See all events',
  version: 2,
  url: 'https://data.kingcounty.gov/resource/grxi-zqg2.json?display_on_kc_home_page=true'
});
</script>

About that URL above

You have a few choices about how to point to your data.

  • In Socrata, you can create an account and then use that to create a filtered view of the master calendar dataset that's at https://data.kingcounty.gov/County-Operations/public-events/ixih-h5vd.

  • If you are used to SQL, you can use SoQL (Socrata Query Language, documented at https://dev.socrata.com/docs/queries/. This is the most powerful and flexible option.

    • Start with https://data.kingcounty.gov/resource/grxi-zqg2.json? (include the question mark)

    • Filter by whether a category has been checked. For example, if Metro was checked, you'd add metro=true, so the URL would be https://data.kingcounty.gov/resource/grxi-zqg2.json?metro=true

    • String together multiple filter items by using an ampersand. For example, if you only want things categorized as Elections that are displayed on the county home page, the URL would be https://data.kingcounty.gov/resource/grxi-zqg2.json?display_on_kc_home_page=true&elections=true.

    • Pay someone else to do this for you. Email webteam@kingcounty.gov your request and budget number and we will put together the URL for you.

    Data

    We encourage everyone to use the King County master calendar, and then use a filtered view or a special query to display your own calendar items.

    If you are creating your own calendar dataset to work with this script, instead, certain field names and field types are required for it to work.

    • Start time, a time/date field (not with timezone).
    • End time, a time/date field (not with timezone).
    • Event name
    • Location name
    • URL, a Web URL field type
    • If you want a map, include separate address, city, state, and zip fields from which to build a location field

    More information on working with Socrata can be found at in several places: