Google Maps API quota per-second smoothing / notification

Is there any way to throttle or smooth-out-in-time the requests which go to the Google Maps Javascript API from a custom HTML block?

We were about to do a demo and a couple of us were clicking here and there, refreshing, zooming into the map… We ended up exceeding Google’s quota of 1 request per second (100 requests in 100 seconds), which blocked out our access. Is there some way to smooth out the requests coming from Losant? I can see a big spike, I think when I refreshed all the browsers at once and they all requested map tiles at the same time. Really we didn’t need the volume of map-tiles, it was just the instant request all at once which I’m trying to avoid.


Are multiple Custom HTML Blocks on this Dashboard too? If so, yes, that’s a challenge. I think you see this because each Custom HTML Block is a website in a sandboxed iframe. Each iframe will load their own map and map items.

I think the current workaround for this is to use Experience Pages and implement the maps in custom HTML, CSS, and JS (which gives you all the control in the world). However, that would take some reengineering on your end.


I have a better idea for you. So, here is how the block works:

Your page contents are only loaded a single time when the dashboard is initially displayed. In order to receive your query data, your page must include JavaScript that listens to special events that Losant provides. - Docs

Looking at the Google Maps example in the docs:

var drawChart = function() {
    // draw google chart

DashboardBlock.on('change', drawChart)

Here, we are telling the block to redraw the chard on any dashboard change. For your use case, you can look at all the events available and decide when to redraw the map. For example, you can have the map load once and only once and never refresh until the entire page reloads.