Add Google Books previews to your site

A main goal of the Google Books Preview Program is to make your books more discoverable on the web -- and to make it easier for book buyers to preview your titles. In addition to including your titles on Google Books, we provide an API platform that lets websites, such as your own, feature book previews and full-text search capabilities. On this page, we'll explain how to add these features to your site.

Guidelines for implementation

  • When using an example code snippet, be sure to fill in the ISBN for your book.

  • When you an enter an ISBN, we automatically detect whether or not the book is in Google Books. If it's not, nothing will be displayed for that code snippet.

  • Each code snippet must specify a language. The examples below are set to English (en), but you may use any of the following language codes:

    • bg
    • ca
    • hr
    • cs
    • da
    • de
    • es
    • en
    • fi
    • fil
    • fr
    • el
    • hi
    • hu
    • hy
    • id
    • in
    • is
    • it
    • ja
    • ko
    • lv
    • lt
    • nl
    • no
    • pl
    • pt-BR
    • pt-PT
    • ro
    • ru
    • sk
    • sl
    • sr
    • sv
    • th
    • tr
    • uk
    • vi
    • zh-CN
    • zh-TW

    Link to a Google Books Preview page

    <script src="http://books.google.com/books/previewlib.js"></script>
    <script>GBS_setLanguage('en');</script>
    <script>GBS_insertPreviewButtonLink('ISBN:0738531367');</script>

    [ Live demo ]

    Add a button that opens a preview in a pop-up window

    <script src="http://books.google.com/books/previewlib.js"></script>
    <script>GBS_setLanguage('en');</script>
    <script>GBS_insertPreviewButtonPopup('ISBN:0738531367');</script>

    [ Live demo ]

    Embed a 500 by 400 pixel preview inline, right in the page

    Note: if you embed this code into a service like Blogger, please make sure that no <br> tags have been introduced into your code before you publish.

    <script src="http://books.google.com/books/previewlib.js"></script>
    <script>GBS_setLanguage('en');</script>
    <script>GBS_insertEmbeddedViewer('ISBN:0738531367', 500, 400);</script>

    [ Live demo ]

    Link to a separate preview page for a book on your site

    <script src="http://books.google.com/books/previewlib.js"></script>
    <script>GBS_setLanguage('en');</script>
    <script>GBS_insertPreviewButtonLink('ISBN:0738531367', { 'alternativeUrl' : 'http://yoursite.com/yourbook/yourpreviewpage.html' } );</script>

    [ Live demo ]

    Link to a Google Books Preview page on a Co-Branded Search site

    Note: when using this feature, you must include your Co-Branded Search name (houghton in the example below). Once you've set up Co-Branded Search, this name corresponds to the text immediately following the /p/ in your URL, e.g. http://books.google.com/books/p/houghton.

    <script src="http://books.google.com/books/previewlib.js"></script>
    <script>GBS_setLanguage('en');</script>
    <script>GBS_setCobrandName('houghton');</script>
    <script>GBS_insertPreviewButtonLink('ISBN:0738531367');</script>

    [ Live demo ]

    Further information about using this code is available at the Google Books APIs site.