USP Pro provides an option to collect user data, like IP address, user agent, referrer, and more. This post explains how to collect such user data for post-submission forms and contact forms. We’ll also cover how to disable all data collection, or just disable collection of the user’s IP address.
To enable data collection for post-submission forms, follow these steps:
Visit the USP Pro “General” settings and enable “Enable Basic Statistics”.
There is no step 2. After enabling the basic-stats setting, USP Pro automatically will collect user data such as IP Address, User Agent, Referrer, and Request URI. These data will be attached to each submitted post as Custom Fields. See next section, “Viewing the data”.
Viewing the data
To view collected data for submitted posts, visit the “Edit Post” screen for any submitted post and click the “Screen Options” button in the upper-right corner of the screen. There you can check the box to enable the “Custom Fields” meta box. After doing this, you can scroll down the page beneath the post-content field and toggle open the “Custom Fields” panel. There you should find custom fields similar to the following:
usp-address => 123.456.789.0 usp-agent => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36 usp-referer => http://example.com/?usp_form=submit usp-request => http://example.com/?usp_form=submit
These custom fields can be used anywhere in your theme, or in plugins, etc. They are very versatile, enabling you to make use of the collected data however is desired.
To enable data collection for contact forms, follow these steps:
Visit the USP Pro “Admin” settings and enable Contact Form ▸ “Include User Stats”.
There is no step 2. After enabling the user-stats setting, USP Pro automatically will collect user data such as IP Address, User Agent, Referrer, and Request URI. These data will be included in each email sent by any contact form. See next section, “Viewing the data”.
Viewing the data
To view collected data for contact forms, look at any email that was sent via your form. Appended to the message, you should find something similar to the following:
Message Details --------------- Name: WordPress User Email: firstname.lastname@example.org URL: https://example.com Time: 2021-07-30 19:44:59 IP Address: 123.123.123 Request: https://example.com/the-request/?example Referrer: https://example.com/the-referrer/?example User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36
Check out the next section if you want to disable only the IP address information.
Disable IP collection
Let’s say you have implemented data collection for your forms using either of the above techniques (post-submit forms and/or contact forms). If you would like to continue collecting data such as user agent, referrer, and request infos, but disable collection of all IP address data, visit the Advanced tab and check the box to “Disable IP Collection”. When that option is enabled, the plugin will not make use of any user IP data.