Using our own API keys Google Map

This topic contains 6 replies, has 3 voices, and was last updated by  mb 9 years ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #137684

    mb
    Buyer
    Post count: 151

    Hi support,

    we need to use our own API keys to track the map hits for Google Maps. Any idea where in the code we should plug them?

    I suppose we have to change code in a source file but that’s fine as long as it is working.

    Thanks.

    #137977

    Paolo
    Site Admin
    Post count: 31211

    Hi,

    personally I have no idea… I’ve asked to Stiofan to follow up and let you know.

    Thanks

    #137993

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi mb,

    It looks like Google have started wnating people to use their own api keys now, so it is likely we will add a settig for it in the near future but for now you can simply use this code snippet replacing “YOUR_API_KEY” with your actual api key.

    and add the code to your child theme functions.php

    
    
    add_filter('geodir_googlemap_script_extra', 'my_map_api_key_add',200,1);
    function my_map_api_key_add($extras){
        $extras .= "&key=YOUR_API_KEY";
        return $extras;
    }

    Thanks,

    Stiofan

    #138076

    mb
    Buyer
    Post count: 151

    Thanks, Stiofan! Once again amazed how almost everything with GD can be solved with these little code snippets in functions.php.

    I am a fan. Officially.

    #138369

    mb
    Buyer
    Post count: 151

    Hi Stiofan,

    I applied our API key with the code above. The sidebar maps on search results are working fine, but the Map in the Tab on the Listing Details Page doesn’t work. Just keeps rotating the loading image.

    Do you know which Google APIs we need enabled to make all maps instances working properly?

    Right now we have the following enabled for our API key:

    Google Maps Directions API
    Google Maps Distance Matrix API
    Google Maps Geocoding API
    Google Maps Geolocation API
    Google Maps JavaScript API

    Thanks.

    #138399

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi mb,

    Yeah thats the only ones i have active and it seems to work fine, for the details page it seems to be conflicting with the addition of the places extra, just change the priority to 200 and it should work fine.

    
    
    add_filter('geodir_googlemap_script_extra', 'my_map_api_key_add',200,1);
    function my_map_api_key_add($extras){
        $extras .= "&key=YOUR_API_KEY";
        return $extras;
    }

    Thanks,

    Stiofan

    #138400

    mb
    Buyer
    Post count: 151

    Works like a charm now! Thanks in a million!

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount