Insiteful can help you track form entries and more from virtually any web form in just a few clicks. Many businesses utilize the Google Places API’s Autocomplete function to allow visitors to search and auto-populate multiple location fields from Google Maps. These fields will typically appear something like the below:
However, since Insiteful tracking works based on keystrokes, these programmatically-filled fields may not be captured by the default Insiteful tracking script alone. To workaround this, we have provided an additional, customizable script for tracking location fields populated by the Google Places API:
How to track location fields auto-filled by the Google Places API
In order to properly track location inputs that are auto-filled with the Google Places API, you can simply copy and paste the extra line below after the usual install code:
IMPORTANT: Make sure to replace the list of HTML element IDs in the second line (within the “getGoogleMapFormFields” function) with the unique HTML IDs or selectors (ie. “#field_id” or “[name=’field_name’]”) corresponding to the other form fields that are auto-filled by the Google Places API.
<script async defer>getGoogleMapFormFields("#street_field, #city_field, #zip_field"); //REPLACE THESE IDS WITH YOUR FORM FIELDS</script>
NOTE: Make sure that the field which allows users to search Google Maps via the Places API has the HTML class “pac-input” for this to function correctly.
How to track partial entries & abandonment in your existing forms
- Add your website: Just login to Insiteful & visit the Domains page and add your website where indicated in the screenshot below.
- Install code: Adding Insiteful to your website is as simple as copy and paste: simply add the two codes from the Install page — that’s all there is to it! If some of your inputs are dynamically rendered (ie. hidden / conditional fields) after the page load, copy the the additional tracking code above.