-1

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.

patpatwithhat
  • 335
  • 2
  • 11

1 Answers1

0

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?

chriswhong
  • 362
  • 2
  • 9