I have a problem with Google Maps Javascript Api. I want to detect if my daily limit quota of 25,000 map loads per 24 hours as described here is reached.
I already searched for a lot of similar questions, as [1, 2, 3, 4], but they:
- have no useful response (1)
- use other Api and not Google Maps Javascript Api (2)
- refers to geocoding and not map loading (3)
- use Google Api Console (4)
The only question that I find useful is this. It refers to Google documentation, that says:
If you want to programmatically detect an authentication failure (for example to automatically send an beacon) you can prepare a callback function. If the following global function is defined it will be called when the authentication fails. function gm_authFailure() { /* Code */ };
If I have a simple script like this:
<script>
function initMap() {
var map;
map = new google.maps.Map(document.getElementById('map'), {
zoom: 7,
center: { lat: 42.345, lng: 12.46 }
});
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=MYKEY&callback=initMap"></script>
How can I implement function gm_authFailure(), in order to detect query limit reached?
I'm new to Js and have no clue how to do that. Can you give me some examples?