Skip Navigation

[Resolved] Maps data caching and API hits

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to know more about Google Maps API hits. What is cached and what is not cached? What should I expect as site traffic grows? What should I expect as site content size grows?

Solution: Google's JavaScript Maps API will be hit each time a visitor loads a map on your site. This cost will continue to grow as your site traffic grows, and there is no caching available for these hits. The Geocoding API will be hit only when new data is entered for address fields. This cost will not continue to grow as site traffic grows, but will continue to grow as site content grows and new addresses are added. These geocoded addresses are cached for future use, so an address will only be geocoded once. The Places API will be hit for autosuggest menus, and this cost will continue to grow as site traffic grows.

Relevant Documentation:
https://cloud.google.com/maps-platform/pricing/sheet

This support ticket is created 4 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by glenn 4 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1577229

Tell us what you are trying to do?
setup maps caching

Is there any documentation that you are following?
toolset maps documentation

Is there a similar example that we can see?
no

What is the link to your site?
hidden link

My real question is this:
I have caching enabled on the website. However since the Corona outbreak this sites traffic has spiked . This has lead to google billing for the use of the API. What i wanted to know is how this works. I was under the assumption that 'Toolset maps' only connects to the API when data is entered, not when it is requested(through a page visit). Is this correct?

Also, people visit this site on the map to get cycling directions on their smartphone. Is this something that might cause the issue?

Since this i s a non-profit organisation the costs need to be limited.

#1577307
Capture.JPG

I also see that the requests are centered around the maps javascript API

#1577713

Hi, normally address caching is automatic and you don't need to do anything special. Most cases I've seen where caching is not working involve a MySQL version lower than 5.6, which is the minimum requirement for distance calculations: https://toolset.com/toolset-requirements/
What version of MySQL are you running on this server? If it's <5.6, an upgrade is probably required.

#1578429

Hi Christian,

thank you for your reply. I think i haven't made my problem clear. It seems that cahcing is working, however i just wanted to check if the increase in API request is due to the increased traffic.

I was under the assumption that Toolset Maps only connects when data is entered. If this is so then i should not see the increased API calls right?

Or do i not understand it correctly and are there still API calls being made when a visitor visits the site and interacts with the map?

If the API calls are being made when a visitor uses a map i know there is nothing worng. However if API calls are only being made on data entry i might have to see what is going wrong.

Kind regards,

Glenn

#1578643

Or do i not understand it correctly and are there still API calls being made when a visitor visits the site and interacts with the map?
Okay I misundertstood, sorry! Yes and no, there are multiple APIs to consider here. The JavaScript Maps API is hit every time a visitor loads a map on your site. That is normal, and these hits will continue to increase as traffic increases. There's nothing you can do here to cache these hits. The Geocoding API should only be hit once per location, when location data is entered. Then that data is cached for future use, so this number should not increase as traffic increases. It should increase as your site content grows. The Places API is typically used for autocomplete features, when someone types a location for search. This API traffic will continue to increase as traffic increases.

#1578739

Hi Christian, thank you so much for your reply. Then it is set up properly. My client has to file her organisation as a non-profit so she can get a non-profit account for this initiative.

Kind regards,

Glenn