Remove Google Maps API
I’m just trying to optimize the speed of my page a little and most complains gtmetrix has come from the Google Maps api.
Since I’m not using any map (front + backoffice), I want to simply remove the whole api.
Can anyone tell me where the maps api is located?
romaric17 last edited by
My Thirtybees front doesn’t load any Google Maps API.
I think you have to disable any module that could load the Google Maps API or may be check if it’s your theme that loads it.
Hmm, is there a way to trace it back?
I can’t see a module that seems obvious.
But perhaps I just ask the template-support.
Ah ok, it actually was a module - in my case TM Mega Menu.
I just edited the file modules > tmmegamenu > tmmegamenu.php
Somewhere there (line ~2679) are two lines like this
’://maps.google.com/maps/api/js?region=’.Tools::substr($default_country->iso_code, 0, 2);
I just removed the first part so it looks like this:
:’’.Tools::substr($default_country->iso_code, 0, 2);
datakick last edited by
@manisch that’s not a good solution. This will probably create script tag in your page like this:
@datakick hmm, right now everything seems fine.
What would you suggest?
datakick last edited by datakick
@Manisch I would need to see source code of the module. But I believe that the line you’ve mentioned starts with something like this:
You will want to remove the whole line. Next, search for text ‘google.maps’ in *.js files of this module… and get rid of all references to google maps api… somehow…
@datakick it might seem a little dirty, but I was just glad it works without error so far But it actually looks like this (XXX marks where once was the url)
$google_script = 'http'.((Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 's' : '').'XXX'.Tools::substr($default_country->iso_code, 0, 2); $entry = strpos(implode(',', $this->context->controller->js_files), $google_part);
$this->context->controller->addJS('http'.((Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 's' : '').'XXX'.Tools::substr($default_country->iso_code, 0, 2)); $this->context->controller->addJS($this->_path.'views/js/admin.js');```