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.

Post-Submit Forms

To enable data collection for post-submission forms, follow these steps:

Step 1

Visit the USP Pro “General” settings and enable “Enable Basic Statistics”.

Step 2

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”.

Note: To disable collection of user data for all post-submit forms, simply disable the option “Enable Basic Statistics” under the USP General settings.

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.

Contact Forms

To enable data collection for contact forms, follow these steps:

Step 1

Visit the USP Pro “Admin” settings and enable Contact Form ▸ “Include User Stats”.

Step 2

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”.

Note: To disable collection of user data for all contact forms, simply disable the option “Include User Stats” under the USP Admin settings.

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: user@example.com
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.

Note: Disabling IP collection applies to everything: submitted posts, contact forms, email alerts — everything.