Specify API Key For Google Matrix API Javascript To Retrieve Usage
<p>i am using google matrix API successfully to retrieve the time and distance for location a to location b.</p>

<pre><code>var origins = [Task.getItem("Y") + "," + Task.getItem("X")];
            var destinations = [LAT + "," + LNG];

            var distanceMatrix = new google.maps.DistanceMatrixService();
            var distanceRequest = {
                origins: origins,
                destinations: destinations,
                travelMode: google.maps.TravelMode.DRIVING,
                unitSystem: google.maps.UnitSystem.METRIC,
                avoidHighways: false,
                avoidTolls: false
            };
            distanceMatrix.getDistanceMatrix(distanceRequest, function(response, status) {
                if (status != google.maps.DistanceMatrixStatus.OK) {
                    alert('Error was: ' + status);
                } else {
                    var origins = response.originAddresses;
                    var destinations = response.destinationAddresses;
                    //debugger;
                    if (response.rows[0].elements[0].distance != null) {
                        totalDistance = response.rows[0].elements[0].distance.value;
                        totalTime = response.rows[0].elements[0].duration.value;
                        ratioPerOneMeter = totalDistance / totalTime;
                        PRDifference = 0;

                        updateDistanceAndTime();

                    } else {
                        alert("The Distance And Time Cannot Be Calculated");
                    }
                }
            });
</code></pre>

<p>What I want to do is add the API key but I don't know how. I did add in the API key:</p>

<pre><code>&lt;script src="http://maps.googleapis.com/maps/api/js?key={KEY}&amp;v=3.exp"&gt;
</code></pre>

<p>as stated here: 
<a href="https://stackoverflow.com/questions/26899484/using-a-google-apps-api-key-with-distance-matrix">Using a Google Apps API key with Distance Matrix</a></p>

<p>but I think this is just for the map and not for the matrix API. Can someone inform me if this is enough.</p>