Google Civic Information API

Embed the Voter Information Tool

The Google Voter Information Tool lets users look up their polling place, early vote sites, ballot, and election official information for the US elections supported by the Voting Information Project. The tool is embeddable, meaning it's easy to use on your own website to let your users find their voter information. Data in the tool comes from the Google Civic Information API.

Quick Embed

Insert the following code where you want the Voter Information Tool to appear on your site, and replace ELECTION_ID with an appropriate Election ID. The Election ID indicates which local election you wish to query. For example, the 2012 US General Election or the 2013 NYC Mayoral Primaries. Learn more about Election IDs here.

<script type="text/javascript" src="https://voter-info-tool.appspot.com/js/loader.js"></script>
<div id="_vit"></div>
<script type="text/javascript">vit.load({election_id:ELECTION_ID});</script>

vit.load method

You can add additional parameters to the vit.load() call above to customize the embedded tool in a number of ways.

vit.load(options?:VITOptions, embedTarget?:String)

Both parameters are optional. options should be an object with the optional properties listed below. embedTarget allows you to change the id of the <div> the tool is embedded into.

VITOptions Properties

Properties Type Description
region String Sets the default state to display in the tool, which will cause it to pre-load a map of the state and display the statewide contests and ballot measures. This can be useful if your site is geared towards an audience from a specific state. Without this option set, the tool will attempt to detect the default state based on the user's IP. To disable this (and always default to the US map), set this property to null.
address String Pre-loads full voting information results for an address. This could allow you to prompt users for their address on one page and display the tool on another.
locale String Changes the language used in the tool. The tool currently supports values of en for English and es for Spanish.
official_only boolean When set to true, limits the tool to return only official data published and verified directly by a state or local election official, excluding data collected from official sources by trusted third party partners. With this option set, the tool will not include coverage for all 50 states.
election_id String The Election ID the tool should query. When not provided, this defaults to the US 2012 General Election ID of 4000. Learn more about Election IDs here.
base_sharing_url String If present, a +1 button will be displayed on the tool and will allow sharing of the provided URL.

Examples

Default view to California

vit.load({'region': 'CA'});

Pre-load information for a given address

vit.load({'address': '1600 pennsylvania ave nw, washington, dc'});

Default view to Maryland, and only use official data sources

vit.load({'region': 'MD', 'official_only': true});

Further Customizations

If you'd like to make more advanced customizations, the entire Voter Information Tool is open source. Any developer can download the source and modify it to create a version that suits their needs. Find the open source project on Google Code here.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.