Intermittent Maps API errors - google-maps-api-3

We've been using Google Maps API v3 on our website for a few months, with everything working fine. Then, suddenly, today we've started seeing intermittent errors saying:
"Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site."
I went back and checked the API console, and everything appears fine, and how I left it when we first set it up. Given the intermittent nature, I'm suspecting some transient problem with Google's servers.
Has anyone seen this sort of behavior before, or happen to know what might be causing it?

Related

Google Translate API not working in Restricted mode

We are using Google Translate API using SDK in our app build using ReactNative. The Google API Key does not work when we make it restricted, however without restrictions it is working fine. Due to security reasons we have to make it restricted. Any help shall be appreciated.

How to fix Google Maps API RefererDeniedMapError

I am working on a web app that includes a map using the Google Maps Javascript API. It works on our development server, but whenever trying to access it on stage or production using our company domain, I get an RefererDeniedMapError.
The docs at https://developers.google.com/maps/documentation/javascript/error-messages#referer-denied-map-error clearly state that this error means Google has blocked our domain for violating ToS. An appeal was submitted but Google claims the domain is not blocked and to see further help here. I've already turned off all API restrictions and removed all referrer restrictions as well, but are still getting the same problems.
I can access the app by going directly to the web app server, but anytime I go through our company's domain name, the error returns, which leads me to believe that we are in fact blocked.
Has anyone experienced an issue like this or know of a workaround for this? I've looked through the related posts on the topic but have not found anything useful info to help resolve the problem.
Edit:
The website is using sensors to track packages in the mail for our customers and alerts them if the sensor gets too much light, is dropped, etc. There are no restriction methods at all. I've added a couple screenshots showing the maps working on development but not during testing.
Map working in development
Map not working on test server
At first look, it just seems to be a normal restriction error, however, since you've said that there are currently no restrictions applied in your API key and is working properly in server-side but not in production, this seems to be an issue with your API key, can you try to generate a new API key and use it in your website? If the issue still persist, then this will require a technical support from Google Maps Platform as this may be an issue in the GCP Console. You may file a support case via https://console.cloud.google.com/google/maps-apis/support in order to open personalized communication channel.

Google Analytics: tracking offline mobile apps

We're tracking our web apps using GTM (Google Tag Manager) and GA360 (the paid version of GA).
We also have hybrid mobile apps (mobile apps built with web frontend) that are intended for our users to work mostly offline (they are kind of reader apps).
I've been doing some research and there's a lot of information but I'm not sure yet of what's the best approach to connect my mobile apps to GA when they're mostly offline.
I've found Google Analytics for Firebase which is a free service but seems to be a separate service from GA and I would end up with half of the analytics in GA and the other half in Firebase.
I also read about using Workbox to support Offline Google Analytics:
https://developers.google.com/web/tools/workbox/guides/enable-offline-analytics
What's actually the best approach for this kind of problem?
What service(s) can I use to solve this problem?
Thank you.
I'm not sure if either of the other two approaches mentioned above are better or even work in this context, but I wanted to mention a third approach, linked below.
It is not simple, involving writing custom google analytics calls to check online status, and either queue requests yourself when offline, or post them when online.
It should work well though, and end up keeping all of your analytics in one console.
Simo Ahava Blog: Track users who are offline in Google Analytics.

What is difference between the Google Maps API project and credentials (key)?

I have several simple Javascript Google maps on two websites. What is project here - each map or everything ? Or maybe maps on one website are one project ? But they have nothing to do with each other. How many projects should be created and how many credentials ? So far I created one project and so many credentials as maps in it. But these maps are separated, almost all different, only few of them generated by one common php, but even in this case half of them are completely different in the internet.
I don't understand this at all.
Thank you.
Usually you should use one API Project for each "property" which is displaying maps. If you have one website where you tracking popular fishing spots and another website where you provide a directions to a local restaurant those should probably be two different API projects.
Each individual map shouldn't have it's own project.
Thanks. This is going to be a supplementary question. Yesterday I created already second project for maps located on second website (despite they have nothing to do with each other except location on the same domain), created new API keys for those maps and deleted their API keys in the first project, because they are in the second project now.
And maps can't be displayed any more. Google Maps is gray and displays information:
Oops! Something went wrong. This page didn't load Google Maps
correctly. See the JavaScript console for technical details.
The Javascript console says:
"Google Maps API error: DeletedApiProjectMapError
https://developers.google.com/maps/documentation/javascript/error-messages#deleted-api-project-map-error"
js:32:350
The same maps work fine without API key, but don't work with the new API key !
Here is an example:
http://darz-bor.info/mapy/puszcza/
I will keep this file with not working API key 1-2 days to allow you to see it and after that will remove API key.
How to make the new API keys working ?
go to Maps JavaScript API and Active this part.

After months of 100% stability, today I get 403 Error on google maps services

I was just wondering if someone could shed some light on why I am seeing 403 Forbidden errors for my google maps services.
I had been loading the maps api as such:
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
And then using both the geocoding and autocomplete libraries to turn user searches into co-ordinates to display on a map on my search results.
This was working perfectly (for months) until yesterday, when I started seeing 403 Errors whenever the Autocomplete service was accessed.
I am 100% confident I wasn't reaching the 25k per day limit on queries, and I made no code changes on my side.
I have now added in an API key to my script load, and the problem dissapeared, but I want to be sure this doesn't happen again. Location based search is a main feature on our site, and if it breaks, we lose customers.
Does anyone have any insight as to why this may have happened?
And under what circumstances can it happen again?
This problem just re-emerged even with an API key set - and I think the issue actually lies with caching the google maps javascript.
I have my web server dynamically decide what javascript to combine, minify and cache locally. This is done using RequestReduce.
When the client-side javascript becomes stale (roughly 3 days in my case) - google returns 403 unauthorized.
The API key was just a red herring. I can remove the key and my code still works - as long as the maps js is "fresh".
In my case, the fix was to add maps.googleapis.com to the RequestReduce ignore list:
javascriptUrlsToIgnore="maps.googleapis.com"
For others, just make sure to not cache the maps.googleapis.com javascript for more than a few hours, if at all.
The Google Maps JavaScript API recently advanced a minor version increment to 3.9changelog and the default version advanced from 3.6 to 3.7. I notice that you aren't specifying a version in the URL you use to load the Google Maps JavaScript API library, so you retrieve the default version, 3.7. One important thing about version 3.7 is that it now requires the use of keys for some libraries. Info about which version you should use is available in the Versioning section of the Developer's Guide.
A few others have run into similar problems, but if you are running fine after adding the key, you should be good. If you would like to receive notifications about Google Maps API changes in the future, you may register for notifications.

Resources