Errors / JavaScript errors
Uncaught ReferenceError: google is not defined
The page tried to draw a Google map before Google's map script had loaded.
The map is a grey box or missing, and anything built on it (a store locator) is empty.
Why it happens
- The Maps JavaScript API is loaded
asyncordeferand the page's own map code runs before it. - The Maps script failed: a missing or restricted API key, billing not enabled, or the request blocked.
- A cookie-consent tool holds Google's scripts back until the visitor accepts.
How to fix it
- Use the
callback=parameter of the Maps script, or theimportLibraryloader, and start the map there. - Look at the Maps request itself and the message Google logs next to it (a key or billing error says so in words).
- If consent gates it, start the map from the consent tool's accepted event, and show a placeholder until then.
Whose problem it is
Usually the site's own code or settings.
Does your site have it?
Free, no account. We open your page and four more in a clean Chrome and list every error like this one, with the page and the click that caused it. How the free page check works.
Often seen with
- x is not definedA script used a name nobody declared, usually because another script it depends on did not load first.