Acquaint Softtech Private Limited

Geolocation Tracker for Forms Documentation

Acquaint Softtech Private Limited

Geo Location Tracker For Forms

Geo Location is a Statamic addon that allows you to capture and store the geolocation information of users submitting forms on your Statamic website.

Features

Here is a list of features provided by the Geo-Location Tracker addon for Statamic forms

  • IP Address: Retrieve and save the IP address of the user's device at the time of form submission.
  • Country Name: Capture and store the name of the country where the form submission originated.
  • Country Code: Retrieve and save the country code associated with the submitted geolocation.
  • Region Code: Capture the code representing the region or state where the form submission took place.
  • Region Name: Store the name of the region or state associated with the submitted geolocation.
  • City Name: Capture and save the name of the city where the form submission occurred.
  • Zip Code: Retrieve and store the postal code associated with the submitted geolocation.
  • Latitude: Capture the latitude coordinates of the user's device at the time of form submission.
  • Longitude: Store the longitude coordinates of the user's device at the time of form submission.

These features enable you to gather comprehensive geolocation information from form submissions, allowing you to analyze and utilize the data in various ways within your Statamic website.

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install. Or run the following command in terminal from your projects root folder:

composer require acquaint-softtech/geo-location

Publish the addon's configuration file by running the following command:

php artisan vendor:publish --tag=geo-location-tracker-config

How to Use

To make use of the Geo-Location Tracker addon for Statamic forms, follow these steps:

Step 1: Link Geo-Location Fieldset in Form Blueprint, Save the blueprint file.

Note: If you change anything on this field set then it will not work.

fieldsets

formBlueprint

Step 2: Configure the Geo-Location Tracker Addon

The addon provides a configuration file to customize its behavior. Locate the geo-location-tracker.php file in the config directory of your Statamic installation. Make the following configurations:

2.1. Test Local Setting To test addon in local environment, you can set the test_local option to True

If set to true, the addon will work in your local system for testing purposes. If set to false, the addon will be enabled for use on the live site.

'test_local' => true,

2.2. Static IP Setting

If you set test_local to true, Need to specify a static public IP address for testing purposes. This IP will be used instead of the actual user's IP. Set the static_ip option to your desired IP address:

'static_ip' => '208.67.222.222',

formSubmittedData

Step 3: Email Template Usage

To display the captured geolocation data in your email template, use the following format:

<ul>
    {{ geo_location_data }}
        <li>Ip: {{ ip }}</li>
        <li>Country Name: {{ country_name }}</li>
        <li>Country Code: {{ country_code }}</li>
        <li>Region Code: {{ region_code }}</li>
        <li>Region Name: {{ region_name }}</li>
        <li>City Name: {{ city_name }}</li>
        <li>Zip Code: {{ zip_code }}</li>
        <li>Latitude: {{ latitude }}</li>
        <li>Longitude: {{ longitude }}</li>
    {{ /geo_location_data }}
</ul>

This code snippet will output the geolocation information within an unordered list. You can modify the HTML structure and customize the template as per your requirements.

That's it! By following these steps, you can successfully utilize the Geo-Location Tracker addon in your Statamic forms. The captured geolocation data will be included in the email template, providing valuable insights about the users' location when they submit the form.