HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Use MaxMind with Forms

📘

Prerequisites

  • Install EPiServer.Forms package from NuGet.
  • Install EPiServer.Personalization.MaxMindGeolocation package from NuGet.
  1. Sign in or sign up at MaxMind.

  2. Download the GeoLite2 database to the data folder in project (for example, App_Data).. You can download ASN, City, or Country data file and .csv location file.

  3. Open Startup.cs file.

  4. Add AddMaxMindGeolocationProvider with config to services object as below sample.

    services
      .AddCmsAspNetIdentity < ApplicationUser > ()
      .AddCms()
      .AddVisitorGroupsUI()
      .AddCmsHost()
      .AddAlloy()
      .AddAdminUserRegistration()
      .AddEmbeddedLocalization < Startup > ()
      .AddMaxMindGeolocationProvider(configure => {
        configure.DatabasePath = Path.Combine(_webHostingEnvironment.ContentRootPath, "App_Data", "GeoLite2-City.mmdb");
        configure.LocationsDatabasePath = Path.Combine(_webHostingEnvironment.ContentRootPath, "App_Data", "GeoLite2-City-Locations-en.csv");
      });
    
  5. Add Hidden visitor profiling into a form container and edit that element.

  1. Select Geo in the Auto-collect visitor data section with any value listed (such as City).
  1. Drag and drop the form to a page and publish it.
  2. Submit the form.
  3. Verify submission data.