1
votes

is there a way to request how many tiles were already requested this month for a given API key?
Or would I need a backend, to keep track?
On this side, I can see the requested tiles: https://account.mapbox.com/
But it only updates daily, not live.

Any help is appreciated.

1
Doesn't look like that's exposed in the APIs. - Ouroborus

1 Answers

0
votes

There is a transformRequest option you can use when you instantiate the map. You could add code to it to trigger a counter somewhere else whenever a tile is requested.

See options.transformRequest here:

https://docs.mapbox.com/mapbox-gl-js/api/map/#map

Here is an example of how it is used: How to specify Authorization Header for a source in mapbox-gl-js?