Web API Core | ComponentOne
Services / Visitor API / Configuring Google Map API
In This Topic
    Configuring Google Map API
    In This Topic

    Visitor API has built-in provider that help to find Visitor geometry location using GoogleMap API. It is a paid service which requires an API Key. Google Map works on the client-side, therefore, it requires the visitor client to send a request to the GeoLocation API to look up visitor's address based on their latitude and longitude location while the visitor client script loads. This parses the response from Google Map Geocoding API and stores the value back to visitor client.

    To configure the Google Map API, you need add the following code to the Startup.cs file in your Web API application.

    C#
    Copy Code
    public void ConfigureServices(IServiceCollection services)
    {
        // ...
        services.ConfigureVisitor(builder =>
        {
            builder.UseGoogleMapLocation(*GoogleMapApiKey*);
        });
    }
    

    As shown in the code above, Visitor API requires a Google Map API Key in the configuration session. To get the Google Map API key, follow the instructions on the Google Maps Platform.