How to set an API key when using Google's script loader?

ejain picture ejain · Jan 19, 2013 · Viewed 8.3k times · Source

I registered my project and generated a browser key at https://code.google.com/apis/console/.

Now how do I use that key when using the Google Script Loader?

I've been doing this, which works (with or without the key parameter), but even after several weeks the API console shows no requests:

<script src=//www.google.com/jsapi?key=my_key"></script>
<script>
    google.load('maps', '3.10', { other_params : 'libraries=places&sensor=false', callback : ... })
</script>

Answer

Dr.Molle picture Dr.Molle · Jan 19, 2013

The key is useless for the jsapi, you must append it to other_params:

<script>
    google.load('maps', '3', {
        other_params: 'key=my_key',
        callback: function(){}
    });
</script>