Get access to free tutorials, exclusive content and more.

4 Tricks for Capturing Additional User Data in WordPress Forms

As a digital marketer, you know that the key to running a successful campaign is maximizing the data you gather from each form submission. While getting basic information from users through form fields is straightforward, you often need more to understand your audience.

  • Wondering from which source your users are coming?
  • Need to pinpoint the exact post or page where a form was submitted on your site?
  • Managing a multisite and looking to track the specific URL of a submission?
  • Or, aiming to automatically capture a logged-in user’s name or email?

All these tasks can be achieved with the right know-how. They may seem daunting initially, but with our simple, lesser-known tips, you can effortlessly enhance your WordPress forms to collect essential additional user data.

Discover these easy yet powerful tricks now!

1. Capture WordPress Post and Page information with each submission.

There are lots of reasons why you might want the URL of the post or page the form is being submitted from to show up either in your WordPress forms submissions or in an admin email. Most commonly, we see users with a standard form placed in a widget or footer and need to know which page the submission took place on. That’s really easy to accomplish!

  1. Add a Hidden field to your form.
  2. Set the Default Value of the field to {wp:post_url}

Add the post URL via merge tag to the Hidden field of your WordPress form.

That’s it! If you want this in the email, be sure to include the merge tag for the hidden field in the email message body. If you’re using the {fields_table} merge tag, you’ll need to switch to the {all_fields_table} merge tag instead or specifically include the Hidden field merge tag in addition to the {fields_table} tag.

2. Capture user data from a logged-in WordPress user

Many times, you’ll want to get info on a logged-in user without having to ask them to fill in basic info like their name and email each time they submit a form. Ordinarily, this would turn into a file editing headache, but with this trick, it’s super simple.

All you need to do to capture user data in WordPress forms is:

  1. Place the receiving field on your form (Hidden if you don’t want the user to see it otherwise, a field like first name, last name, etc.)
  2. Set the Default Value of the field to the WordPress user data to merge the tag you need.

Some of the available WordPress user data merge tags are:

  • {wp:user_first_name}
  • {wp:user_last_name}
  • {wp:user_display_name}
  • {wp:user_email}

Example:

Add user metadata to your WordPress form field.

3. Capture the WordPress site URL or Title with each submission

If you’re collecting user data into a CRM from multiple sites, you may need to keep up with the website the WordPress form data is coming from. That’s as easy as adding a merge tag to a hidden field.

  1. Place a Hidden field on your form.
  2. Insert either {wp:site_title} or {wp:site_url} as the Default Value of that field

Add the site URL via merge tag to the Hidden field of your WordPress form.

4. Capture the referring source for each user that lands on your form

This is a little more complex, but still pretty darn simple using a merge tag. We’ll be using a querystring value to do this. If you need a primer or refresher on using querystrings, check out the full article.

  1. Modify the URL the user is clicking to get to your form with the querystring key/value that you need to pass the data you want. For example, ?source=twitter
  2. Place a hidden field onto your form and set its default value as {querystring:source}, where “source” is the key you chose to use in the first step.

When the user clicks through to the form, the Hidden field will capture the Value you assigned the Key in the referring URL. In our example, it will show up as “twitter.”

There’s even more data you can capture in each of your WordPress forms!

These four tricks each use a merge tag to capture the data you need. They don’t even cover all the available merge tags at your disposal, though! For a full list of merge tags that you can use to capture user data in WordPress forms:

  1. Open your Ninja Forms builder
  2. Add a form field
  3. Click the merge tag icon in the Default Value setting of that field.
  4. Click on the WordPress or Other tabs of the modal that opens

Curious about more ways to utilize our merge tags in your WordPress forms? Dive into our comprehensive merge tags documentation or explore ‘12 Powerful Merge Tag Examples For your WordPress Form Submissions!‘ for innovative ideas!

Enjoy discovering the variety of data you can capture with your WordPress forms. If you have any questions or suggestions — perhaps something you wish we included but haven’t yet — please share them below. Your feedback is invaluable in shaping the future of our plugin!