Using logic5 Min.

How to use WordPress variables in your form

With the hidden field block in Tripetto you can instantly collect and use WordPress variables, like user information, website data, visitor data and server data.

When to use

There are lots of use cases in which you can use certain variables from outside the form to make your form more smart or more personal. In the WordPress plugin you can collect such data instantly. Some use cases:

  • Get the email address of the logged in WordPress user, so the user does not have to enter the email address;
  • Collect the IP addresses of your respondents to filter duplicate entries from your results data afterwards;
  • Gather the referrer URL to see where the respondent came from before entering your form.
Screenshot of variables in a form in Tripetto
Demonstration of WordPress variables in a Tripetto form.

How to use

In the article you're reading now we describe how to use WordPress variables in your form. We use the hidden field block for that. For global instructions about the hidden field block, please have a look at this article.

Add hidden field block

First add a hidden field block and open it in the builder. You may add a name to this hidden field block, so you can recognize it.

Select WordPress variable

In the hidden field block you'll see a dropdown menu Type of field. That determines the data you want to collect with this hidden field block.

Now select the desired data you want to collect:

  • User / Username;
  • User / Nickname;
  • User / Display name;
  • User / First name;
  • User / Last name;
  • User / Email address;
  • User / Website;
  • User / Biographical info;
  • User / Avatar (URL);
  • User / Language;
  • User / ID;
  • Website / URL;
  • Website / Title;
  • Website / Tagline;
  • Website / Administration email address;
  • Website / Language;
  • Visitor / IP address;
  • Visitor / Language;
  • Visitor / Referrer URL;
  • Server / URL;
  • Server / Protocol;
  • Server / Port;
  • Server / Host name;
  • Server / Path;
  • Server / Querystring;
  • Server / IP address;
  • Server / Software;
  • Server / WordPress version;
  • Server / PHP version.

And that's it! The hidden field block will now collect and store the selected WordPress variable in your form.

Screenshot of a hidden field block with WordPress variable in Tripetto
A form setup with several hidden field blocks that collect WordPress variables.

Important! Data privacy legislation

Please be aware you comply with any data privacy legislation that affects your data gathering. With the WordPress variables in the hidden field block, it's possible to collect personal information that may be subject to data privacy legislation. Tripetto does not collect any personal information on its own, so it's your own responsibility which personal information you collect and to comply to data privacy legislation. Data privacy legislation can differ per worldwide location, so please make sure you comply to the legislation that applies to your form.

Example: collecting IP addresses in accordance with European legislation (GDPR)

In Europe the General Data Protection Regulation (GDPR) applies to all data you collect. This states that IP addresses should be considered as personal data and thus collecting such data must comply with the corresponding GDPR legislation. It's your own responsibility to decide if you need to collect IP addresses and to comply to the rules set by the GDPR.

Use WordPress variable

Now the hidden field block automatically collects the WordPress variable you selected. In general you can now do the following with the value in that hidden field block:

  • Save variable in dataset;
  • Show variable in form (piping logic);
  • Use variable as value in other input block;
  • Use variable as logic condition (branch logic).

We will explain each of these possibilities below.

Save variable in dataset

By default the value of each hidden field block will be saved to your dataset. That way the variable will be available in your results, exports, notifications and webhooks.

Show variable in form (piping logic)

You can show the variable to your respondent in the form in realtime. All hidden field blocks are available for piping logic, by typing the @ sign at the position you want to show the value.

Have a look at this article for more information about piping logic.

Use variable as value in other input block

The variable can also be used to set the value of other input blocks in your form, for example to update the value of an email address input block with the email address of the WordPress user.

Have a look at this article for more information about the set value block.

Use variable as logic condition (branch logic)

You can use the variable to check if a certain branch applies to your filter for that branch.

Have a look at this article for more information about branch logic.

More information

The WordPress variables are part of the hidden field block: How to use the hidden field block.

In this article

    Help us improve